Java Code Examples for io.swagger.models.Path#getOptions()
The following examples show how to use
io.swagger.models.Path#getOptions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwaggerEndpointSource.java From light-rest-4j with Apache License 2.0 | 6 votes |
@Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = SwaggerHelper.swagger.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from Swagger spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = basePath + pathPair.getKey(); Path pathImpl = pathPair.getValue(); if(pathImpl.getGet() != null) addEndpoint(endpoints, path, "get"); if(pathImpl.getPut() != null) addEndpoint(endpoints, path, "put"); if(pathImpl.getHead() != null) addEndpoint(endpoints, path, "head"); if(pathImpl.getPost() != null) addEndpoint(endpoints, path, "post"); if(pathImpl.getDelete() != null) addEndpoint(endpoints, path, "delete"); if(pathImpl.getPatch() != null) addEndpoint(endpoints, path, "patch"); if(pathImpl.getOptions() != null) addEndpoint(endpoints, path, "options"); } return endpoints; }
Example 2
Source File: PathUtils.java From swagger2markup with Apache License 2.0 | 5 votes |
/** * Returns the operations of a path as a map which preserves the insertion order. * * @param path the path * @return the operations of a path as a map */ private static Map<HttpMethod, Operation> getOperationMap(Path path) { Map<HttpMethod, Operation> result = new LinkedHashMap<>(); if (path.getGet() != null) { result.put(HttpMethod.GET, path.getGet()); } if (path.getPut() != null) { result.put(HttpMethod.PUT, path.getPut()); } if (path.getPost() != null) { result.put(HttpMethod.POST, path.getPost()); } if (path.getDelete() != null) { result.put(HttpMethod.DELETE, path.getDelete()); } if (path.getPatch() != null) { result.put(HttpMethod.PATCH, path.getPatch()); } if (path.getHead() != null) { result.put(HttpMethod.HEAD, path.getHead()); } if (path.getOptions() != null) { result.put(HttpMethod.OPTIONS, path.getOptions()); } return result; }
Example 3
Source File: SwaggerConverter.java From swagger-parser with Apache License 2.0 | 4 votes |
public PathItem convert(Path v2Path) { PathItem v3Path = new PathItem(); if (v2Path instanceof RefPath) { v3Path.set$ref(((RefPath) v2Path).get$ref()); } else { if (v2Path.getParameters() != null) { for (io.swagger.models.parameters.Parameter param : v2Path.getParameters()) { v3Path.addParametersItem(convert(param)); } } io.swagger.models.Operation v2Operation; v2Operation = v2Path.getGet(); if (v2Operation != null) { v3Path.setGet(convert(v2Operation)); } v2Operation = v2Path.getPut(); if (v2Operation != null) { v3Path.setPut(convert(v2Operation)); } v2Operation = v2Path.getPost(); if (v2Operation != null) { v3Path.setPost(convert(v2Operation)); } v2Operation = v2Path.getPatch(); if (v2Operation != null) { v3Path.setPatch(convert(v2Operation)); } v2Operation = v2Path.getDelete(); if (v2Operation != null) { v3Path.setDelete(convert(v2Operation)); } v2Operation = v2Path.getHead(); if (v2Operation != null) { v3Path.setHead(convert(v2Operation)); } v2Operation = v2Path.getOptions(); if (v2Operation != null) { v3Path.setOptions(convert(v2Operation)); } v3Path.setExtensions(convert(v2Path.getVendorExtensions())); } return v3Path; }