本文整理了Java中io.swagger.models.Path.set()
方法的一些代码示例,展示了Path.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.set()
方法的具体详情如下:
包路径:io.swagger.models.Path
类名称:Path
方法名:set
暂无
代码示例来源:origin: jooby-project/jooby
path.set(method(route), op);
代码示例来源:origin: com.vmware.xenon/xenon-swagger
Operation.STATUS_CODE_NOT_FOUND, responseGenericError()
));
path.set(Service.Action.GET.name().toLowerCase(), get);
代码示例来源:origin: apache/servicecomb-java-chassis
protected void addOperationToSwagger() {
if (StringUtils.isEmpty(httpMethod)) {
return;
}
Path pathObj = swagger.getPath(path);
if (pathObj == null) {
pathObj = new Path();
swagger.path(path, pathObj);
}
HttpMethod hm = HttpMethod.valueOf(httpMethod.toUpperCase(Locale.US));
if (pathObj.getOperationMap().get(hm) != null) {
throw new Error(String.format("Only allowed one default path. %s:%s",
swaggerGenerator.getCls().getName(),
providerMethod.getName()));
}
pathObj.set(httpMethod, operation);
}
}
代码示例来源:origin: kongchen/swagger-maven-plugin
protected void updatePath(String operationPath, String httpMethod, Operation operation) {
if (httpMethod == null) {
return;
}
Path path = swagger.getPath(operationPath);
if (path == null) {
path = new Path();
swagger.path(operationPath, path);
}
path.set(httpMethod, operation);
}
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core
private boolean isPathNotExist(Map<String, UriTemplate> uriTemplateMap, String securityName, Map.Entry<String,
Path> entry) {
Path path = entry.getValue();
String uri = entry.getKey();
path.getOperationMap().entrySet().forEach(httpMethodOperationEntry -> {
if (isOperationNotExist(httpMethodOperationEntry, uri, uriTemplateMap, securityName)) {
path.set(httpMethodOperationEntry.getKey().name().toLowerCase(), null);
}
});
return path.isEmpty();
}
代码示例来源:origin: wso2/carbon-apimgt
private boolean isPathNotExist(Map<String, UriTemplate> uriTemplateMap, String securityName, Map.Entry<String,
Path> entry) {
Path path = entry.getValue();
String uri = entry.getKey();
path.getOperationMap().entrySet().forEach(httpMethodOperationEntry -> {
if (isOperationNotExist(httpMethodOperationEntry, uri, uriTemplateMap, securityName)) {
path.set(httpMethodOperationEntry.getKey().name().toLowerCase(), null);
}
});
return path.isEmpty();
}
代码示例来源:origin: org.apache.servicecomb/swagger-generator-core
protected void addOperationToSwagger() {
if (StringUtils.isEmpty(httpMethod)) {
return;
}
Path pathObj = swagger.getPath(path);
if (pathObj == null) {
pathObj = new Path();
swagger.path(path, pathObj);
}
HttpMethod hm = HttpMethod.valueOf(httpMethod.toUpperCase(Locale.US));
if (pathObj.getOperationMap().get(hm) != null) {
throw new Error(String.format("Only allowed one default path. %s:%s",
swaggerGenerator.getCls().getName(),
providerMethod.getName()));
}
pathObj.set(httpMethod, operation);
}
}
代码示例来源:origin: com.google.api/api-compiler
private Path getNewWildCardPathObject(Path userDefinedWildCardPathObject) {
Preconditions.checkNotNull(
userDefinedWildCardPathObject, "userDefinedWildCardPathObject cannot be null");
Path path = new Path();
if (userDefinedWildCardPathObject.getGet() == null) {
path.set("get", constructReservedOperation("Get"));
}
if (userDefinedWildCardPathObject.getDelete() == null) {
path.set("delete", constructReservedOperation("Delete"));
}
if (userDefinedWildCardPathObject.getPatch() == null) {
path.set("patch", constructReservedOperation("Patch"));
}
if (userDefinedWildCardPathObject.getPost() == null) {
path.set("post", constructReservedOperation("Post"));
}
if (userDefinedWildCardPathObject.getPut() == null) {
path.set("put", constructReservedOperation("Put"));
}
return path;
}
代码示例来源:origin: googleapis/api-compiler
private Path getNewWildCardPathObject(Path userDefinedWildCardPathObject) {
Preconditions.checkNotNull(
userDefinedWildCardPathObject, "userDefinedWildCardPathObject cannot be null");
Path path = new Path();
if (userDefinedWildCardPathObject.getGet() == null) {
path.set("get", constructReservedOperation("Get"));
}
if (userDefinedWildCardPathObject.getDelete() == null) {
path.set("delete", constructReservedOperation("Delete"));
}
if (userDefinedWildCardPathObject.getPatch() == null) {
path.set("patch", constructReservedOperation("Patch"));
}
if (userDefinedWildCardPathObject.getPost() == null) {
path.set("post", constructReservedOperation("Post"));
}
if (userDefinedWildCardPathObject.getPut() == null) {
path.set("put", constructReservedOperation("Put"));
}
return path;
}
代码示例来源:origin: org.ballerinalang/ballerina-to-swagger
/**
* Resource mapper when a resource has more than 1 http method.
*
* @param pathMap The map with paths that should be updated.
* @param resource The ballerina resource.
*/
private void useMultiResourceMapper(Map<String, Path> pathMap, BLangFunction resource) {
List<String> httpMethods = this.getHttpMethods(resource, false);
String path = this.getPath(resource);
Path pathObject = new Path();
Operation operation;
if (httpMethods.size() > 1) {
int i = 1;
for (String httpMethod : httpMethods) {
//Iterate through http methods and fill path map.
operation = this.convertResourceToOperation(resource, httpMethod, i).getOperation();
pathObject.set(httpMethod.toLowerCase(Locale.ENGLISH), operation);
i++;
}
}
pathMap.put(path, pathObject);
}
代码示例来源:origin: tminglei/binder-swagger-java
public ExOperation mkOperation(HttpMethod method, String path) {
notEmpty(path, "'path' CAN'T be null or empty!!!");
notEmpty(method, "'method' CAN'T be null or empty!!!");
synchronized (swagger) {
String origPath = path;
path = path.replaceAll("<[^>]+>", "").replaceAll("/:([^/]+)", "/{$1}"); // replace `/:id<[0-9]+>` with `/{id}`
if (swagger.getPath(path) == null) {
logger.info(">>> adding path - '" + path + "'");
swagger.path(path, new Path());
}
Path pathObj = swagger.getPath(path);
if (pathObj.getOperationMap().get(method) != null) {
throw new IllegalArgumentException("DUPLICATED operation - " + method + " '" + path + "'");
}
logger.info(">>> adding operation - " + method + " '" + path + "'");
pathObj.set(method.name().toLowerCase(), new ExOperation(this, method, path));
implemented.put(entry(method, path), true); // set implemented by default
String prevPath = origPaths.put(entry(method, path), origPath);
if (prevPath != null) throw new IllegalArgumentException(
"`" + path + "` was repeatedly defined by `" + prevPath + "` and `" + origPath + "`!!!");
return (ExOperation) pathObj.getOperationMap().get(method);
}
}
代码示例来源:origin: com.gitblit.fathom/fathom-rest-swagger
path.set(route.getRequestMethod().toLowerCase(), operation);
log.debug("Add {} {} => {}",
route.getRequestMethod(), operationPath, Util.toString(method));
代码示例来源:origin: wso2/carbon-apimgt
if (stringPathMap.containsKey(uriTemplateString)) {
Path path = stringPathMap.get(uriTemplateString);
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
} else {
Path path = new Path();
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
stringPathMap.put(uriTemplateString, path);
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core
if (stringPathMap.containsKey(uriTemplateString)) {
Path path = stringPathMap.get(uriTemplateString);
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
} else {
Path path = new Path();
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
stringPathMap.put(uriTemplateString, path);
代码示例来源:origin: Sayi/swagger-dubbo
swagger.path(parsedPath, path);
path.set(httpMethod.toLowerCase(), operation);
代码示例来源:origin: yangfuhai/jboot
swagger.path(parsedPath, path);
path.set(httpMethod.toLowerCase(), operation);
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core
path.set(v.getHttpVerb().toLowerCase(), operationTocCreate);
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
} else {
Path path = new Path();
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
stringPathMap.put(uriTemplateString, path);
代码示例来源:origin: wso2/carbon-apimgt
path.set(v.getHttpVerb().toLowerCase(), operationTocCreate);
代码示例来源:origin: wso2/carbon-apimgt
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
} else {
Path path = new Path();
path.set(uriTemplate.getHttpVerb().toLowerCase(), operation);
stringPathMap.put(uriTemplateString, path);
内容来源于网络,如有侵权,请联系作者删除!