本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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());
}
示例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;
}
示例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;
}
示例8: responseNoContent
import io.swagger.models.Response; //导入方法依赖的package包/类
private Response responseNoContent() {
Response res = new Response();
res.setDescription(DESCRIPTION_ERROR);
return res;
}
示例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;
}
示例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));
}