当前位置: 首页>>代码示例>>Java>>正文


Java Response.setDescription方法代码示例

本文整理汇总了Java中io.swagger.models.Response.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Response.setDescription方法的具体用法?Java Response.setDescription怎么用?Java Response.setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.swagger.models.Response的用法示例。


在下文中一共展示了Response.setDescription方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decorateOperation

import io.swagger.models.Response; //导入方法依赖的package包/类
@Override
public void decorateOperation(final Operation operation, final Method method, final Iterator<SwaggerExtension> chain) {

    final TestVendorAnnotation annotation = method.getAnnotation(TestVendorAnnotation.class);
    if (annotation != null) {

        Map<String, Response> map = new HashMap<String, Response>(operation.getResponses());
        final Response value = new Response();
        value.setDescription(RESPONSE_DESCRIPTION);
        map.put(RESPONSE_STATUS_401, value);
        operation.setResponses(map);
    }

    if (chain.hasNext()) {
        chain.next().decorateOperation(operation, method, chain);
    }
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:18,代码来源:TestVendorExtension.java

示例2: decorateOperation

import io.swagger.models.Response; //导入方法依赖的package包/类
@Override
public void decorateOperation(final Operation operation, final Method method, final Iterator<SwaggerExtension> chain) {

    final TestVendorAnnotation annotation = method.getAnnotation(TestVendorAnnotation.class);
    if (annotation != null) {

        Map<String, Response> map = new HashMap<String, Response>(operation.getResponses());
        final Response value = new Response();
        value.setDescription(RESPONSE_DESCRIPTION);
        map.put(RESPONSE_STATUS_501, value);
        operation.setResponses(map);
    }

    if (chain.hasNext()) {
        chain.next().decorateOperation(operation, method, chain);
    }
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:18,代码来源:VendorExtensionWithoutReader.java

示例3: generateResponse

import io.swagger.models.Response; //导入方法依赖的package包/类
private static void generateResponse(Swagger swagger, ResponseConfig responseConfig) {
  Response response = new Response();

  Property property = generateResponseProperty(swagger, responseConfig);
  response.setSchema(property);
  response.setDescription(responseConfig.getDescription());

  if (responseConfig.getResponseHeaders() != null) {
    Map<String, Property> headers = generateResponseHeader(swagger, responseConfig.getResponseHeaders());
    response.setHeaders(headers);
  }

  responseConfig.setResponse(response);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:AnnotationUtils.java

示例4: correctResponses

import io.swagger.models.Response; //导入方法依赖的package包/类
public static void correctResponses(Operation operation) {
  int okCode = Status.OK.getStatusCode();
  String strOkCode = String.valueOf(okCode);
  Response okResponse = null;

  for (Entry<String, Response> responseEntry : operation.getResponses().entrySet()) {
    Response response = responseEntry.getValue();
    if (StringUtils.isEmpty(response.getDescription())) {
      response.setDescription("response of " + responseEntry.getKey());
    }

    if (operation.getResponses().get(strOkCode) != null) {
      continue;
    }

    int statusCode = NumberUtils.toInt(responseEntry.getKey());
    if ("default".equals(responseEntry.getKey())) {
      statusCode = okCode;
    }
    if (Family.SUCCESSFUL.equals(Family.familyOf(statusCode))) {
      okResponse = response;
    }
  }

  if (okResponse != null) {
    operation.addResponse(strOkCode, okResponse);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:29,代码来源:SwaggerUtils.java

示例5: correctResponsesOperationNotChangeExistDescription

import io.swagger.models.Response; //导入方法依赖的package包/类
@Test
public void correctResponsesOperationNotChangeExistDescription() {
  Response response = new Response();
  response.setDescription("description");

  Operation operation = new Operation();
  operation.addResponse("200", response);

  SwaggerUtils.correctResponses(operation);
  Assert.assertEquals("description", response.getDescription());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:12,代码来源:TestSwaggerUtils.java

示例6: paramResponse

import io.swagger.models.Response; //导入方法依赖的package包/类
private Response paramResponse(RequestRouter.Parameter routeParam, Route route) {
    Response response = new Response();
    response.setDescription(routeParam.description);
    if (routeParam.type == null) {
        return response;
    }
    setResponseType(response, routeParam.type);
    return response;
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:10,代码来源:SwaggerAssembler.java

示例7: responseOk

import io.swagger.models.Response; //导入方法依赖的package包/类
private Response responseOk(Class<?> type) {
    Response res = new Response();
    res.setDescription(DESCRIPTION_SUCCESS);

    if (type == null) {
        return res;
    }

    res.setSchema(refProperty(modelForPodo(type)));
    return res;
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:12,代码来源:SwaggerAssembler.java

示例8: responseNoContent

import io.swagger.models.Response; //导入方法依赖的package包/类
private Response responseNoContent() {
    Response res = new Response();
    res.setDescription(DESCRIPTION_ERROR);
    return res;
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:6,代码来源:SwaggerAssembler.java

示例9: responseGenericError

import io.swagger.models.Response; //导入方法依赖的package包/类
private Response responseGenericError() {
    Response res = new Response();
    res.setDescription(DESCRIPTION_ERROR);
    res.setSchema(refProperty(modelForPodo(ServiceErrorResponse.class)));
    return res;
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:7,代码来源:SwaggerAssembler.java

示例10: testGenerateModelName_description

import io.swagger.models.Response; //导入方法依赖的package包/类
@Test
public void testGenerateModelName_description() {
    Response r = new Response();
    r.setDescription("Descriptive text will be converted to model name [email protected]$%#^$#%");
    Assert.assertEquals("Wrong model name", "Descriptivetextwillbeconvertedtomodelname", client.generateModelName(r));
}
 
开发者ID:awslabs,项目名称:aws-apigateway-importer,代码行数:7,代码来源:ApiGatewaySdkSwaggerApiImporterTest.java


注:本文中的io.swagger.models.Response.setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。