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; }
private void setInfoFromAnnotation() { Info resultInfo = new Info(); for (Class<?> aClass : getValidClasses(SwaggerDefinition.class)) { SwaggerDefinition swaggerDefinition = AnnotationUtils.findAnnotation(aClass, SwaggerDefinition.class); io.swagger.annotations.Info infoAnnotation = swaggerDefinition.info(); Info info = new Info().title(infoAnnotation.title()) .description(emptyToNull(infoAnnotation.description())) .version(infoAnnotation.version()) .termsOfService(emptyToNull(infoAnnotation.termsOfService())) .license(from(infoAnnotation.license())) .contact(from(infoAnnotation.contact())); Map<String, Object> customExtensions = BaseReaderUtils.parseExtensions(infoAnnotation.extensions()); for (Map.Entry<String, Object> extension : customExtensions.entrySet()) { resultInfo.setVendorExtension(extension.getKey(), extension.getValue()); } resultInfo.mergeWith(info); } info = resultInfo; }
private void convertInfo(io.swagger.annotations.Info infoAnnotation, Swagger swagger) { if (infoAnnotation == null) { return; } Info info = new Info(); info.setTitle(infoAnnotation.title()); info.setVersion(infoAnnotation.version()); info.setDescription(infoAnnotation.description()); info.setTermsOfService(infoAnnotation.termsOfService()); info.setContact(convertContact(infoAnnotation.contact())); info.setLicense(convertLicense(infoAnnotation.license())); info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoAnnotation.extensions())); swagger.setInfo(info); }
operation.summary(apiOperation.value()).description(apiOperation.notes()); Map<String, Object> customExtensions = BaseReaderUtils.parseExtensions(apiOperation.extensions()); operation.setVendorExtensions(customExtensions);
@Override public void process(Object annotation, OperationGenerator operationGenerator) { ApiOperation apiOperationAnnotation = (ApiOperation) annotation; 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); convertProduces(apiOperationAnnotation.produces(), operation); convertConsumes(apiOperationAnnotation.consumes(), operation); convertProtocols(apiOperationAnnotation.protocols(), operation); AnnotationUtils.addResponse(operationGenerator.getSwagger(), operation, apiOperationAnnotation); // responseReference未解析 // hidden未解析 // authorizations未解析 }
Map<String, Object> customExtensions = BaseReaderUtils.parseExtensions(apiOperation.extensions()); operation.setVendorExtensions(customExtensions);
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; }
private void convertInfo(io.swagger.annotations.Info infoAnnotation, Swagger swagger) { if (infoAnnotation == null) { return; } Info info = new Info(); info.setTitle(infoAnnotation.title()); info.setVersion(infoAnnotation.version()); info.setDescription(infoAnnotation.description()); info.setTermsOfService(infoAnnotation.termsOfService()); info.setContact(convertContact(infoAnnotation.contact())); info.setLicense(convertLicense(infoAnnotation.license())); info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoAnnotation.extensions())); swagger.setInfo(info); }
@Override public void process(Object annotation, OperationGenerator operationGenerator) { ApiOperation apiOperationAnnotation = (ApiOperation) annotation; 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); convertProduces(apiOperationAnnotation.produces(), operation); convertConsumes(apiOperationAnnotation.consumes(), operation); convertProtocols(apiOperationAnnotation.protocols(), operation); AnnotationUtils.addResponse(operationGenerator.getSwagger(), operation, apiOperationAnnotation); // responseReference未解析 // hidden未解析 // authorizations未解析 }
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagConfig.extensions()));
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
info.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(infoConfig.extensions()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagConfig.extensions()));
tag.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(tagConfig.extensions()));