當前位置: 首頁>>代碼示例>>Java>>正文


Java Path.getGet方法代碼示例

本文整理匯總了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;
}
 
開發者ID:limberest,項目名稱:limberest,代碼行數:22,代碼來源:SwaggerRequest.java

示例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;
}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:25,代碼來源:SwaggerUtils.java

示例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;
}
 
開發者ID:googleapis,項目名稱:api-compiler,代碼行數:23,代碼來源:ProtoApiFromOpenApi.java

示例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());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:27,代碼來源:TestApiOperation.java

示例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;
}
 
開發者ID:Swagger2Markup,項目名稱:swagger2markup,代碼行數:34,代碼來源:PathUtils.java


注:本文中的io.swagger.models.Path.getGet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。