本文整理匯總了Java中io.swagger.models.Path.put方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.put方法的具體用法?Java Path.put怎麽用?Java Path.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.swagger.models.Path
的用法示例。
在下文中一共展示了Path.put方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: path2UtilAvailable
import io.swagger.models.Path; //導入方法依賴的package包/類
private Path path2UtilAvailable(Parameter idParam) {
Path path = new Path();
if (idParam != null) {
path.setParameters(Collections.singletonList(paramId()));
}
io.swagger.models.Operation get = new io.swagger.models.Operation();
get.addTag(this.currentTag.getName());
get.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(),
Operation.STATUS_CODE_UNAVAILABLE, responseNoContent(),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()));
path.setGet(get);
io.swagger.models.Operation patchOrPut = new io.swagger.models.Operation();
patchOrPut.addTag(this.currentTag.getName());
patchOrPut.setParameters(Collections.singletonList(paramBody(ServiceStat.class)));
patchOrPut.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(template(ServiceStats.class)),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()));
path.put(patchOrPut);
path.patch(patchOrPut);
return path;
}
示例2: path2UtilStats
import io.swagger.models.Path; //導入方法依賴的package包/類
private Path path2UtilStats(Parameter idParam) {
Path path = new Path();
if (idParam != null) {
path.setParameters(Collections.singletonList(paramId()));
}
io.swagger.models.Operation get = new io.swagger.models.Operation();
get.addTag(this.currentTag.getName());
get.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(template(ServiceStats.class)),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()));
path.set(Service.Action.GET.name().toLowerCase(), get);
io.swagger.models.Operation put = new io.swagger.models.Operation();
put.addTag(this.currentTag.getName());
put.setParameters(Arrays.asList(
paramNamedBody(template(ServiceStats.class)),
paramNamedBody(ServiceStats.ServiceStat.class)));
put.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(template(ServiceStats.class)),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()));
path.put(put);
io.swagger.models.Operation post = new io.swagger.models.Operation();
post.addTag(this.currentTag.getName());
post.setParameters(Collections.singletonList(paramBody(ServiceStat.class)));
post.setResponses(responseMap(
Operation.STATUS_CODE_OK, responseOk(template(ServiceStats.class)),
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()));
path.post(post);
path.patch(post);
return path;
}
示例3: buildSwagger
import io.swagger.models.Path; //導入方法依賴的package包/類
private Swagger buildSwagger(final Request request) {
final Swagger swagger = new Swagger();
swagger.host(request.getHeader("Host"));
swagger.info(buildInfo());
for (final Map.Entry<String, Map<HttpRequestMethodType, ServerEndpointView>> entry :
serviceRegistry.getRegisteredEndpoints().entrySet()) {
final Path path = new Path();
for (final Map.Entry<HttpRequestMethodType, ServerEndpointView> endpointEntry : entry.getValue().entrySet()) {
final HttpRequestMethodType methodType = endpointEntry.getKey();
final String key = entry.getKey();
final ServerEndpointView endpoint = endpointEntry.getValue();
if (!ignoreEndpoint(endpoint)) {
final Tag tag = buildTag(endpoint.getMethod().getDeclaringClass());
swagger.addTag(tag);
switch (methodType) {
case GET:
case ANY:
path.get(buildOperation(endpoint, tag, methodType));
break;
case POST:
path.post(buildOperation(endpoint, tag, methodType));
break;
case PUT:
path.put(buildOperation(endpoint, tag, methodType));
break;
case DELETE:
path.delete(buildOperation(endpoint, tag, methodType));
break;
default:
throw new UnsupportedOperationException("Unsupported method type " + methodType);
}
swagger.path(key, path);
}
}
}
return swagger;
}