-
Notifications
You must be signed in to change notification settings - Fork 348
Open
Description
as title, SwaggerConfig impl implements ApiListingScannerPlugin with swagger2-3.0.x.
But some classes are annotated with @declaration
`
@configuration
public class SwaggerConfig implements ApiListingScannerPlugin {
@OverRide
public List apply(
DocumentationContext documentationContext) {
return Arrays.asList(buildLogin());
}
private ApiDescription buildLogin() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(new ParameterBuilder()
.description("用户名")
.type(new TypeResolver()
.resolve(String.class))
.name("username")
.parameterType(QUERY_PARAMETER_TYPE)
.parameterAccess(PARAMETER_ACCESS)
.required(true)
.modelRef(new ModelRef(MODEL_REF))
.build());
parameters.add(new ParameterBuilder().description("密码")
.type(new TypeResolver()
.resolve(String.class))
.name("password")
.parameterType(
QUERY_PARAMETER_TYPE)
.parameterAccess(
PARAMETER_ACCESS)
.required(true)
.modelRef(
new ModelRef(MODEL_REF))
.build());
return new ApiDescription("登录",
"/login", "登录","登录",
Collections.singletonList(new OperationBuilder(
new CachingOperationNameGenerator())
/** HTTP请求类型 */
.method(HttpMethod.POST)
.produces(Sets.newHashSet(
MediaType.APPLICATION_JSON_VALUE))
.summary("登录接口")
/** 方法描述 */
.notes("登录接口")
/** 归类标签 */
.tags(Sets.newHashSet("认证控制"))
.parameters(parameters)
.uniqueId("login")
.build()),
false);
}
@Override
public boolean supports(DocumentationType documentationType) {
return DocumentationType.OAS_30.equals(documentationType);
}
}
`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels