io.swagger.v3.oas.models.OpenAPI.path()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中io.swagger.v3.oas.models.OpenAPI.path()方法的一些代码示例,展示了OpenAPI.path()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OpenAPI.path()方法的具体详情如下:
包路径:io.swagger.v3.oas.models.OpenAPI
类名称:OpenAPI
方法名:path

OpenAPI.path介绍

暂无

代码示例

代码示例来源:origin: swagger-api/swagger-core

@Test
public void testSerializeASpecWithPathReferences() throws Exception {
  OpenAPI swagger = new OpenAPI()
      .addServersItem(new Server().url("http://petstore.swagger.io"));
  PathItem expectedPath = new PathItem().$ref("http://my.company.com/paths/health.json");
  swagger.path("/health", expectedPath);
  String swaggerJson = Json.mapper().writeValueAsString(swagger);
  OpenAPI rebuilt = Json.mapper().readValue(swaggerJson, OpenAPI.class);
  final PathItem path = rebuilt.getPaths().get("/health");
  assertEquals(path, expectedPath);
}

代码示例来源:origin: swagger-api/swagger-core

@Test
  public void testSerializeASpecWithResponseReferences() throws Exception {
    OpenAPI swagger = new OpenAPI()
        .addServersItem(new Server().url("http://petstore.swagger.io"));

    ApiResponse expectedResponse = new ApiResponse().$ref("http://my.company.com/paths/health.json");
    PathItem expectedPath = new PathItem()
        .get(
            new Operation().responses(
                new ApiResponses()
                    .addApiResponse("200", expectedResponse)));

    swagger.path("/health", expectedPath);

    String swaggerJson = Json.mapper().writeValueAsString(swagger);
    OpenAPI rebuilt = Json.mapper().readValue(swaggerJson, OpenAPI.class);

    assertEquals(rebuilt.getPaths().get("/health").getGet().getResponses().get("200"), expectedResponse);

  }
}

代码示例来源:origin: swagger-api/swagger-core

.path("/pets", new PathItem().get(get));

代码示例来源:origin: swagger-api/swagger-core

.addList("api_key"));
oas.path("/pets", new PathItem().get(get));

代码示例来源:origin: io.swagger.parser.v3/swagger-parser-v3

updateLocalRefs(resolvedPath, pathRef);
openAPI.path(pathStr, resolvedPath);
pathItem = resolvedPath;

代码示例来源:origin: swagger-api/swagger-parser

updateLocalRefs(resolvedPath, pathRef);
openAPI.path(pathStr, resolvedPath);
pathItem = resolvedPath;

代码示例来源:origin: org.openapitools.swagger.parser/swagger-parser-v3

updateLocalRefs(resolvedPath, pathRef);
openAPI.path(pathStr, resolvedPath);
pathItem = resolvedPath;

相关文章