@ApiOperation(value = "获取用户信息", notes = "userName:用户名{必传},  password:密码{必传} \n")
@ApiImplicitParams({
            @ApiImplicitParam(name = "userName", value = "用户名", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String", paramType = "query")
    })

添加 required = true

来指定该参数必传

附swagger-ui的扫描配置

 

@Configuration  // 注册成ioc组件
@EnableSwagger2  //开启swagger2
public class SwaggerConfig {

    // 扫描所有带@ApiOperation注解的类
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .build();
    }


}

 

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2021-12-20
  • 2021-12-12
  • 2022-12-23
  • 2021-10-13
  • 2021-12-14
猜你喜欢
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-09-13
  • 2021-03-25
相关资源
相似解决方案