io.swagger.models.Swagger.vendorExtension()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(249)

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

Swagger.vendorExtension介绍

暂无

代码示例

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

@JsonAnySetter
public void setVendorExtension(String name, Object value) {
  if (name.startsWith("x-")) {
    vendorExtension(name, value);
  }
}

代码示例来源:origin: io.syndesis.rest/rest-connector-generator

@Test
public void shouldDetermineHostFromSpecificationUrl() {
  final URI specificationUrl = URI.create("https://api.example.com/swagger.json");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)))
    .isEqualTo("https://api.example.com");
  assertThat(
    determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl).scheme(Scheme.HTTP)))
      .isEqualTo("http://api.example.com");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)
    .host("api2.example.com").scheme(Scheme.HTTP))).isEqualTo("http://api2.example.com");
}

代码示例来源:origin: io.syndesis.server/server-api-generator

@Test
public void shouldDetermineHostFromSpecificationUrl() {
  final URI specificationUrl = URI.create("https://api.example.com/swagger.json");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)))
    .isEqualTo("https://api.example.com");
  assertThat(
    determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl).scheme(Scheme.HTTP)))
      .isEqualTo("http://api.example.com");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)
    .host("api2.example.com").scheme(Scheme.HTTP))).isEqualTo("http://api2.example.com");
}

代码示例来源:origin: io.syndesis.server/server-connector-generator

@Test
public void shouldDetermineHostFromSpecificationUrl() {
  final URI specificationUrl = URI.create("https://api.example.com/swagger.json");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)))
    .isEqualTo("https://api.example.com");
  assertThat(
    determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl).scheme(Scheme.HTTP)))
      .isEqualTo("http://api.example.com");
  assertThat(determineHost(new Swagger().vendorExtension(BaseSwaggerConnectorGenerator.URL_EXTENSION, specificationUrl)
    .host("api2.example.com").scheme(Scheme.HTTP))).isEqualTo("http://api2.example.com");
}

代码示例来源:origin: Valandur/Web-API

swagger.vendorExtension("x-tagGroups", Arrays.asList(
    new TagGroup("Web-API", webapiTags),
    new TagGroup("Integrations", integrationTags)

代码示例来源:origin: io.syndesis/connector-generator

protected final Connector basicConnector(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  // could be either JSON of the Swagger specification or a URL to one
  final String specification = requiredSpecification(connectorSettings);
  if (specification.startsWith("http")) {
    swagger.vendorExtension(URL_EXTENSION, URI.create(specification));
  }
  final Connector baseConnector = baseConnectorFrom(connectorTemplate, connectorSettings);
  final Connector.Builder builder = new Connector.Builder().createFrom(baseConnector);
  final Map<String, String> alreadyConfiguredProperties = builder.build().getConfiguredProperties();
  connectorTemplate.getConnectorProperties().forEach((propertyName, template) -> {
    final Optional<ConfigurationProperty> maybeProperty = PropertyGenerators.createProperty(propertyName, swagger, template);
    maybeProperty.ifPresent(property -> {
      builder.putProperty(propertyName, property);
      if (!alreadyConfiguredProperties.containsKey(propertyName)) {
        final String defaultValue = property.getDefaultValue();
        if (defaultValue != null) {
          builder.putConfiguredProperty(propertyName, defaultValue);
        }
      }
    });
  });
  return builder.build();
}

代码示例来源:origin: io.syndesis.server/server-api-generator

protected final Connector basicConnector(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, APIValidationContext.NONE).getModel();
  // could be either JSON of the Swagger specification or a URL to one
  final String specification = requiredSpecification(connectorSettings);
  if (specification.startsWith("http")) {
    swagger.vendorExtension(URL_EXTENSION, URI.create(specification));
  }
  final Connector baseConnector = baseConnectorFrom(connectorTemplate, connectorSettings);
  final Connector.Builder builder = new Connector.Builder().createFrom(baseConnector);
  final Map<String, String> alreadyConfiguredProperties = builder.build().getConfiguredProperties();
  connectorTemplate.getConnectorProperties().forEach((propertyName, template) -> {
    final Optional<ConfigurationProperty> maybeProperty = PropertyGenerators.createProperty(propertyName, swagger, template);
    maybeProperty.ifPresent(property -> {
      builder.putProperty(propertyName, property);
      if (!alreadyConfiguredProperties.containsKey(propertyName)) {
        final String defaultValue = property.getDefaultValue();
        if (defaultValue != null) {
          builder.putConfiguredProperty(propertyName, defaultValue);
        }
      }
    });
  });
  return builder.build();
}

代码示例来源:origin: io.syndesis.rest/rest-connector-generator

protected final Connector basicConnector(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  // could be either JSON of the Swagger specification or a URL to one
  final String specification = requiredSpecification(connectorSettings);
  if (specification.startsWith("http")) {
    swagger.vendorExtension(URL_EXTENSION, URI.create(specification));
  }
  final Connector baseConnector = baseConnectorFrom(connectorTemplate, connectorSettings);
  final Connector.Builder builder = new Connector.Builder().createFrom(baseConnector);
  final Map<String, String> alreadyConfiguredProperties = builder.build().getConfiguredProperties();
  connectorTemplate.getConnectorProperties().forEach((propertyName, template) -> {
    final Optional<ConfigurationProperty> maybeProperty = PropertyGenerators.createProperty(propertyName, swagger, template);
    maybeProperty.ifPresent(property -> {
      builder.putProperty(propertyName, property);
      if (!alreadyConfiguredProperties.containsKey(propertyName)) {
        final String defaultValue = property.getDefaultValue();
        if (defaultValue != null) {
          builder.putConfiguredProperty(propertyName, defaultValue);
        }
      }
    });
  });
  return builder.build();
}

代码示例来源:origin: io.syndesis.server/server-connector-generator

protected final Connector basicConnector(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  // could be either JSON of the Swagger specification or a URL to one
  final String specification = requiredSpecification(connectorSettings);
  if (specification.startsWith("http")) {
    swagger.vendorExtension(URL_EXTENSION, URI.create(specification));
  }
  final Connector baseConnector = baseConnectorFrom(connectorTemplate, connectorSettings);
  final Connector.Builder builder = new Connector.Builder().createFrom(baseConnector);
  final Map<String, String> alreadyConfiguredProperties = builder.build().getConfiguredProperties();
  connectorTemplate.getConnectorProperties().forEach((propertyName, template) -> {
    final Optional<ConfigurationProperty> maybeProperty = PropertyGenerators.createProperty(propertyName, swagger, template);
    maybeProperty.ifPresent(property -> {
      builder.putProperty(propertyName, property);
      if (!alreadyConfiguredProperties.containsKey(propertyName)) {
        final String defaultValue = property.getDefaultValue();
        if (defaultValue != null) {
          builder.putConfiguredProperty(propertyName, defaultValue);
        }
      }
    });
  });
  return builder.build();
}

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

for(String key : keys) {
  if(key.startsWith("x-")) {
    swagger.vendorExtension(key, extension(on.get(key)));

相关文章