io.swagger.models.Response.example()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中io.swagger.models.Response.example方法的一些代码示例,展示了Response.example的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.example方法的具体详情如下:
包路径:io.swagger.models.Response
类名称:Response
方法名:example

Response.example介绍

暂无

代码示例

代码示例来源:origin: org.ballerinalang/ballerina-to-swagger

/**
 * This method will convert ballerina @Resource to ballerina @OperationAdaptor.
 *
 * @param resource Resource array to be convert.
 * @return Operation Adaptor object of given resource
 */
private OperationAdaptor convertResourceToOperation(BLangFunction resource, String httpMethod, int idIncrement) {
  OperationAdaptor op = new OperationAdaptor();
  if (resource != null) {
    op.setHttpOperation(httpMethod);
    op.setPath('/' + resource.getName().getValue());
    Response response = new Response()
        .description("Successful")
        .example(MediaType.APPLICATION_JSON, "Ok");
    op.getOperation().response(200, response);
    // Replacing all '_' with ' ' to keep the consistency with what we are doing in swagger -> bal
    // @see BallerinaOperation#buildContext
    String resName = resource.getName().getValue().replaceAll("_", " ");
    op.getOperation().setOperationId(getOperationId(idIncrement, resName));
    op.getOperation().setParameters(null);
    // Parsing annotations.
    this.parseResourceConfigAnnotationAttachment(resource, op);
    this.parseResourceInfo(resource, op.getOperation(), httpMethod);
    this.addResourceParameters(resource, op);
    this.parseResponsesAnnotationAttachment(resource, op.getOperation());
  }
  return op;
}

代码示例来源:origin: com.reprezen.genflow/rapidml-swagger

final MediaType type = IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes());
if ((type != null)) {
 swaggerResponse.example(IterableExtensions.<MediaType>head(rapidResponse.getMediaTypes()).getName(), this.renderExample(example.getBody(), type.getName()));

相关文章