本文整理匯總了Java中io.swagger.models.Path.getGet方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.getGet方法的具體用法?Java Path.getGet怎麽用?Java Path.getGet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.swagger.models.Path
的用法示例。
在下文中一共展示了Path.getGet方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOperation
import io.swagger.models.Path; //導入方法依賴的package包/類
public Operation getOperation() {
Path p = swagger.getPath(path.toString());
if (p != null) {
switch (method) {
case GET:
return p.getGet();
case POST:
return p.getPost();
case PUT:
return p.getPut();
case DELETE:
return p.getDelete();
case PATCH:
return p.getPatch();
default:
return null;
}
}
return null;
}
示例2: extractApiOperation
import io.swagger.models.Path; //導入方法依賴的package包/類
/**
* @param swagger Swagger specification
* @param path path of the requested operation
* @param apiPath path of
* @return {@link ApiOperation} if the provided swagger does contain the requested method at the
* provided path, <code>null</code> otherwise
*/
public static ApiOperation extractApiOperation(@NonNull Swagger swagger, @NonNull String path,
@NonNull Path apiPath) {
Method realMethod = Method.GET;
if (apiPath.getGet() != null) {
realMethod = Method.GET;
}
if (apiPath.getPost() != null) {
realMethod = Method.POST;
}
ApiOperationMatch apiOperationMatch =
new ApiOperationResolver(swagger, null).findApiOperation(path, realMethod);
return apiOperationMatch.isPathFound() && apiOperationMatch.isOperationAllowed()
? apiOperationMatch.getApiOperation()
: null;
}
示例3: getNewWildCardPathObject
import io.swagger.models.Path; //導入方法依賴的package包/類
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;
}
示例4: testBase
import io.swagger.models.Path; //導入方法依賴的package包/類
private void testBase(Path path) {
Assert.assertEquals(1, path.getOperations().size());
Operation operation = path.getGet();
Assert.assertEquals("summary", operation.getSummary());
Assert.assertEquals("notes", operation.getDescription());
Assert.assertEquals(Arrays.asList("tag1", "tag2"), operation.getTags());
Assert.assertEquals(Arrays.asList("application/json"), operation.getProduces());
Assert.assertEquals(Arrays.asList("application/json"), operation.getConsumes());
Assert.assertEquals(Arrays.asList(Scheme.HTTP, Scheme.HTTPS), operation.getSchemes());
Map<String, Response> responseMap = operation.getResponses();
Assert.assertEquals(2, responseMap.size());
Response response = responseMap.get(SwaggerConst.SUCCESS_KEY);
Assert.assertNotNull(response);
Assert.assertEquals(null, response.getSchema());
response = responseMap.get("202");
Assert.assertNotNull(response);
Assert.assertEquals(null, response.getSchema());
Assert.assertEquals(1, response.getHeaders().size());
Assert.assertEquals("integer", response.getHeaders().get("h1").getType());
}
示例5: getOperationMap
import io.swagger.models.Path; //導入方法依賴的package包/類
/**
* 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;
}