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


Java Path.set方法代碼示例

本文整理匯總了Java中io.swagger.models.Path.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.set方法的具體用法?Java Path.set怎麽用?Java Path.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.swagger.models.Path的用法示例。


在下文中一共展示了Path.set方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: correctResponsesHavePaths

import io.swagger.models.Path; //導入方法依賴的package包/類
@Test
public void correctResponsesHavePaths() {
  Response response = new Response();

  Operation operation = new Operation();
  operation.addResponse("200", response);

  Path path = new Path();
  path.set("get", operation);

  Swagger swagger = new Swagger();
  swagger.path("/base", path);

  SwaggerUtils.correctResponses(swagger);

  Assert.assertEquals("response of 200", response.getDescription());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:18,代碼來源:TestSwaggerUtils.java

示例2: 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

示例3: 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;
}
 
開發者ID:vmware,項目名稱:xenon-utils,代碼行數:38,代碼來源:SwaggerAssembler.java

示例4: setUp

import io.swagger.models.Path; //導入方法依賴的package包/類
@Before
public void setUp() throws IOException {
  swagger = createSwagger();
  path = "/endpoint";
  method = new Path();
  method.set("get",new Operation());

}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:9,代碼來源:SwaggerUtilsTest.java

示例5: read

import io.swagger.models.Path; //導入方法依賴的package包/類
private void read(ReaderContext context) {

        for (Method method : context.getCls().getDeclaredMethods()) {
            if (ReflectionUtils.isOverriddenMethod(method, context.getCls())) {
                continue;
            }
            final Operation operation = new Operation();


            final Type[] genericParameterTypes = method.getGenericParameterTypes();
            final Annotation[][] paramAnnotations = method.getParameterAnnotations();

            ControllerReaderExtension extension = new ControllerReaderExtension();

            String methodPath = "index".equals(method.getName()) ? "" : "/" + method.getName();
            String operationPath = JbootControllerManager.me().getPathByController((Class<? extends Controller>) context.getCls()) + methodPath;

            String httpMethod = extension.getHttpMethod(context, method);

            if (operationPath == null || httpMethod == null) {
                continue;
            }

            if (extension.isReadable(context)) {
                extension.setDeprecated(operation, method);
                extension.applyConsumes(context, operation, method);
                extension.applyProduces(context, operation, method);
                extension.applyOperationId(operation, method);
                extension.applySummary(operation, method);
                extension.applyDescription(operation, method);
                extension.applySchemes(context, operation, method);
                extension.applySecurityRequirements(context, operation, method);
                extension.applyTags(context, operation, method);
                extension.applyResponses(swagger, context, operation, method);
                extension.applyImplicitParameters(swagger, context, operation, method);
                extension.applyExtensions(context, operation, method);
                for (int i = 0; i < genericParameterTypes.length; i++) {
                    extension.applyParameters(httpMethod, context, operation, paramAnnotations[i]);
                }

                if ("post".equalsIgnoreCase(httpMethod) && operation.getConsumes() == null) {
                    operation.addConsumes("application/x-www-form-urlencoded");
                }
            }

            if (operation.getResponses() == null) {
                operation.defaultResponse(new Response().description("successful operation"));
            }

            final Map<String, String> regexMap = new HashMap<String, String>();
            final String parsedPath = PathUtils.parsePath(operationPath, regexMap);

            Path path = swagger.getPath(parsedPath);
            if (path == null) {
                path = new SwaggerPath();
                swagger.path(parsedPath, path);
            }
            path.set(httpMethod.toLowerCase(), operation);
        }
    }
 
開發者ID:yangfuhai,項目名稱:jboot,代碼行數:61,代碼來源:Reader.java


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