下面列出了io.swagger.annotations.Info#io.swagger.util.BaseReaderUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void applyExtensions(ReaderContext context, Operation operation, Method method) {
final ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
if (apiOperation != null) {
operation.getVendorExtensions()
.putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
}
}
@Override
public void applyExtensions(ReaderContext context, Operation operation, Method method) {
final ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
if (apiOperation != null) {
operation.getVendorExtensions()
.putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
}
}
private Tag convertTag(io.swagger.annotations.Tag tagAnnotation) {
Tag tag = new Tag();
tag.setName(tagAnnotation.name());
tag.setDescription(tagAnnotation.description());
tag.setExternalDocs(convertExternalDocs(tagAnnotation.externalDocs()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagAnnotation.extensions()));
return tag;
}
@Override
public void process(SwaggerGenerator swaggerGenerator,
OperationGenerator operationGenerator, ApiOperation apiOperationAnnotation) {
Operation operation = operationGenerator.getOperation();
operationGenerator.setHttpMethod(apiOperationAnnotation.httpMethod());
if (!StringUtils.isEmpty(apiOperationAnnotation.value())) {
operation.setSummary(apiOperationAnnotation.value());
}
if (!StringUtils.isEmpty(apiOperationAnnotation.notes())) {
operation.setDescription(apiOperationAnnotation.notes());
}
operation.setOperationId(apiOperationAnnotation.nickname());
operation.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(apiOperationAnnotation.extensions()));
convertTags(apiOperationAnnotation.tags(), operation);
SwaggerUtils.setCommaConsumes(operation, apiOperationAnnotation.consumes());
SwaggerUtils.setCommaProduces(operation, apiOperationAnnotation.produces());
convertProtocols(apiOperationAnnotation.protocols(), operation);
AnnotationUtils.addResponse(swaggerGenerator.getSwagger(),
operation,
apiOperationAnnotation);
// responseReference未解析
// hidden未解析
// authorizations未解析
}
public void applyExtensions(ReaderContext context, Operation operation, Method method) {
final ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
if (apiOperation != null) {
operation.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
}
}