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

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

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

OpenAPI.getExtensions介绍

暂无

代码示例

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

@Test
public void testExtension() throws Exception {
  OpenAPI swagger = new OpenAPI();
  swagger.addExtension("x-foo-bar", "foo bar");
  swagger.setInfo(new Info());
  swagger.getInfo().addExtension("x-foo-bar", "foo bar");
  String swaggerJson = Json.mapper().writeValueAsString(swagger);
  assertFalse(swaggerJson.contains("extensions"));
  OpenAPI rebuilt = Json.mapper().readValue(swaggerJson, OpenAPI.class);
  assertEquals(rebuilt.getExtensions().values().iterator().next(), "foo bar");
  assertEquals(rebuilt.getInfo().getExtensions().values().iterator().next(), "foo bar");
}

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

@Test(description = "should deserialize a property with vendor extensions of different types")
public void testDeserializePropertyWithVendorExtensions() throws Exception {
  OpenAPI oas = TestUtils.deserializeJsonFileFromClasspath("specFiles/propertyWithVendorExtensions.json", OpenAPI.class);
  Map<String, Object> oasVendorExtensions = oas.getExtensions();
  Map<String, Object> vendorExtensions = ((Schema) oas.getComponents().getSchemas().get("Health").getProperties().get("status")).getExtensions();
  assertVendorExtensions(oasVendorExtensions);
  assertVendorExtensions(vendorExtensions);
  //check for vendor extensions in array property types
  vendorExtensions = ((Schema) oas.getComponents().getSchemas().get("Health").getProperties().get("array")).getExtensions();
  String xStringValue = (String) vendorExtensions.get("x-string-value");
  assertNotNull(xStringValue);
  assertEquals(xStringValue, "string_value");
}

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

clone.info(filteredOpenAPI.getInfo());
clone.openapi(filteredOpenAPI.getOpenapi());
clone.setExtensions(openAPI.getExtensions());
clone.setExternalDocs(openAPI.getExternalDocs());
clone.setSecurity(openAPI.getSecurity());

代码示例来源:origin: org.openapitools/openapi-generator

gen.writeObjectField("components", value.getComponents());
if(value.getExtensions() != null) {
  for (Entry<String, Object> e : value.getExtensions().entrySet()) {
    gen.writeObjectField(e.getKey(), e.getValue());

代码示例来源:origin: org.openapitools/openapi-generator

Map<String, Object> vendorExtensions = openAPI.getExtensions();
if (vendorExtensions != null) {
  for (Map.Entry<String, Object> vendorExtension : vendorExtensions.entrySet()) {

代码示例来源:origin: org.openapitools/openapi-generator

config.additionalProperties().put("inputSpec", config.getInputSpec());
if (openAPI.getExtensions() != null) {
  config.vendorExtensions().putAll(openAPI.getExtensions());

代码示例来源:origin: quen2404/openapi-diff

});
getExtensionsDiff()
  .diff(oldSpecOpenApi.getExtensions(), newSpecOpenApi.getExtensions())
  .ifPresent(this::setChangedExtension);
return getChangedOpenApi();

代码示例来源:origin: apache/cxf

if (!Objects.equals(configuration.getOpenAPI().getExtensions(), oas.getExtensions())) {
  configuration.getOpenAPI().setExtensions(oas.getExtensions());

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-service-description-openapi-v3

if (!Objects.equals(configuration.getOpenAPI().getExtensions(), oas.getExtensions())) {
  configuration.getOpenAPI().setExtensions(oas.getExtensions());

代码示例来源:origin: org.ballerinalang/swagger-to-ballerina-generator

/**
 * Build a {@link BallerinaOpenApi} object from a {@link OpenAPI} object.
 * All non iterable objects using handlebars library is converted into
 * supported iterable object types.
 *
 * @param openAPI {@link OpenAPI} type object to be converted
 * @return Converted {@link BallerinaOpenApi} object
 * @throws BallerinaOpenApiException when OpenAPI to BallerinaOpenApi parsing failed
 */
@Override
public BallerinaOpenApi buildContext(OpenAPI openAPI) throws BallerinaOpenApiException {
  this.openapi = openAPI.getOpenapi();
  this.info = openAPI.getInfo();
  this.externalDocs = openAPI.getExternalDocs();
  this.tags = openAPI.getTags();
  this.components = openAPI.getComponents();
  this.extensions = openAPI.getExtensions();
  setPaths(openAPI);
  setSecurityRequirements(openAPI);
  setServers(openAPI);
  setSchemas(openAPI);
  return this;
}

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

clone.info(filteredOpenAPI.getInfo());
clone.openapi(filteredOpenAPI.getOpenapi());
clone.setExtensions(openAPI.getExtensions());
clone.setExternalDocs(openAPI.getExternalDocs());
clone.setSecurity(openAPI.getSecurity());

相关文章