io.swagger.util.BaseReaderUtils Java Examples

The following examples show how to use io.swagger.util.BaseReaderUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RpcReaderExtension.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
@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()));
    }

}
 
Example #2
Source File: DubboReaderExtension.java    From swagger-dubbo with Apache License 2.0 5 votes vote down vote up
@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()));
	}

}
 
Example #3
Source File: SwaggerDefinitionProcessor.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: ApiOperationProcessor.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@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未解析
}
 
Example #5
Source File: ControllerReaderExtension.java    From jboot with Apache License 2.0 4 votes vote down vote up
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()));
    }
}