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

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

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

Swagger.getInfo介绍

暂无

代码示例

代码示例来源:origin: apache/servicecomb-java-chassis

protected void collectInterfaceName() {
 if (interfaceName != null) {
  return;
 }
 if (swagger.getInfo() != null) {
  interfaceName = ClassUtils.getInterfaceName(swagger.getInfo().getVendorExtensions());
  if (interfaceName != null) {
   return;
  }
 }
 interfaceName = packageName + ".SchemaInterface";
}

代码示例来源:origin: Swagger2Markup/swagger2markup

/**
 * Builds the overview MarkupDocument.
 *
 * @return the overview MarkupDocument
 */
@Override
public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, OverviewDocument.Parameters params) {
  Swagger swagger = params.swagger;
  Info info = swagger.getInfo();
  buildDocumentTitle(markupDocBuilder, info.getTitle());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder));
  buildOverviewTitle(markupDocBuilder, labels.getLabel(Labels.OVERVIEW));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder));
  buildDescriptionParagraph(markupDocBuilder, info.getDescription());
  buildVersionInfoSection(markupDocBuilder, info);
  buildContactInfoSection(markupDocBuilder, info.getContact());
  buildLicenseInfoSection(markupDocBuilder, info);
  buildUriSchemeSection(markupDocBuilder, swagger);
  buildTagsSection(markupDocBuilder, swagger.getTags());
  buildConsumesSection(markupDocBuilder, swagger.getConsumes());
  buildProducesSection(markupDocBuilder, swagger.getProduces());
  buildExternalDocsSection(markupDocBuilder, swagger.getExternalDocs());
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder));
  applyOverviewDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder));
  return markupDocBuilder;
}

代码示例来源:origin: apache/servicecomb-java-chassis

private void correctInfo() {
 Info info = swagger.getInfo();
 if (info == null) {
  info = new Info();
  swagger.setInfo(info);
 }
 if (StringUtils.isEmpty(info.getTitle())) {
  info.setTitle("swagger definition for " + cls.getName());
 }
 if (StringUtils.isEmpty(info.getVersion())) {
  info.setVersion("1.0.0");
 }
 setJavaInterface(info, cls);
}

代码示例来源:origin: apache/servicecomb-java-chassis

private void initOperations() {
 if (swagger.getPaths() == null) {
  LOGGER.warn(swagger.getInfo().getTitle() + " with path " + swagger.getBasePath()
    + " is an empty interface, please delete it or fill with one method!");
  return;

代码示例来源:origin: amazon-archives/aws-apigateway-importer

private String getApiName(Swagger swagger, String fileName) {
  String title = swagger.getInfo().getTitle();
  return StringUtils.isNotBlank(title) ? title : fileName;
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

protected void collectInterfaceName() {
 if (interfaceName != null) {
  return;
 }
 if (swagger.getInfo() != null) {
  interfaceName = ClassUtils.getInterfaceName(swagger.getInfo().getVendorExtensions());
  if (interfaceName != null) {
   return;
  }
 }
 interfaceName = packageName + ".SchemaInterface";
}

代码示例来源:origin: Sayi/swagger-diff

public String getNewVersion() {
    return newSpecSwagger.getInfo().getVersion();
  }
}

代码示例来源:origin: Sayi/swagger-diff

public String getOldVersion() {
  return oldSpecSwagger.getInfo().getVersion();
}

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

protected void applyDefaultVersion(Swagger data) {
  if (applyDefaultVersion && data.getInfo() != null && data.getInfo().getVersion() == null
      && beanConfig != null && beanConfig.getResourcePackage() != null) {
    Package resourcePackage = Package.getPackage(beanConfig.getResourcePackage());
    if (resourcePackage != null) {
      data.getInfo().setVersion(resourcePackage.getImplementationVersion());
    }
  }
}

代码示例来源:origin: castlemock/castlemock

private String getApplicationName(final Swagger swagger){
  if(swagger.getInfo() != null &&
      swagger.getInfo().getTitle() != null){
    return swagger.getInfo().getTitle();
  } else if(swagger.getHost() != null){
    return swagger.getHost();
  } else if(swagger.getBasePath() != null){
    return swagger.getBasePath();
  }
  throw new IllegalArgumentException("Unable to extract application name " +
      "from the following swagger config: " + swagger);
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

private void correctInfo() {
 Info info = swagger.getInfo();
 if (info == null) {
  info = new Info();
  swagger.setInfo(info);
 }
 if (StringUtils.isEmpty(info.getTitle())) {
  info.setTitle("swagger definition for " + cls.getName());
 }
 if (StringUtils.isEmpty(info.getVersion())) {
  info.setVersion("1.0.0");
 }
 setJavaInterface(info, cls);
}

代码示例来源:origin: com.reprezen.genflow/swagger-nswag

@Override
public void generate(Swagger swagger) throws GenerationException {
  Config config = Config.fromContext(context);
  File outputFile = new File(context.getOutputDirectory(), swagger.getInfo().getTitle() + " Client.cs");
  try {
    new NSwagGenerator(config).generate(config.getNSwagRunFile(swagger, Output.CS_CLIENT, outputFile));
  } catch (IOException e) {
    throw new GenerationException("Failed to run NSwag Generation", e);
  }
}

代码示例来源:origin: com.reprezen.genflow/swagger-nswag

@Override
public void generate(Swagger swagger) throws GenerationException {
  Config config = Config.fromContext(context);
  File outputFile = new File(context.getOutputDirectory(), swagger.getInfo().getTitle() + "Controller.cs");
  try {
    new NSwagGenerator(config).generate(config.getNSwagRunFile(swagger, Output.CS_SERVER, outputFile));
  } catch (IOException e) {
    throw new GenerationException("Failed to run NSwag Generation", e);
  }
}

代码示例来源:origin: com.reprezen.genflow/swagger-nswag

@Override
public void generate(Swagger swagger) throws GenerationException {
  Config config = Config.fromContext(context);
  File outputFile = new File(context.getOutputDirectory(), swagger.getInfo().getTitle() + " Client.js");
  try {
    new NSwagGenerator(config).generate(config.getNSwagRunFile(swagger, Output.TS_CLIENT, outputFile));
  } catch (IOException e) {
    throw new GenerationException("Failed to run NSwag Generation", e);
  }
}

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

@Override
protected final String determineConnectorName(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  final Info info = swagger.getInfo();
  if (info == null) {
    return super.determineConnectorName(connectorTemplate, connectorSettings);
  }
  final String title = info.getTitle();
  if (title == null) {
    return super.determineConnectorName(connectorTemplate, connectorSettings);
  }
  return title;
}

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

@Override
protected final String determineConnectorDescription(final ConnectorTemplate connectorTemplate,
  final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  final Info info = swagger.getInfo();
  if (info == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  final String description = info.getDescription();
  if (description == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  return description;
}

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

@Override
protected final String determineConnectorDescription(final ConnectorTemplate connectorTemplate,
  final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  final Info info = swagger.getInfo();
  if (info == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  final String description = info.getDescription();
  if (description == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  return description;
}

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

@Override
protected final String determineConnectorDescription(final ConnectorTemplate connectorTemplate,
  final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, false).getModel();
  final Info info = swagger.getInfo();
  if (info == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  final String description = info.getDescription();
  if (description == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  return description;
}

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

@Override
protected final String determineConnectorDescription(final ConnectorTemplate connectorTemplate,
  final ConnectorSettings connectorSettings) {
  final Swagger swagger = parseSpecification(connectorSettings, APIValidationContext.NONE).getModel();
  final Info info = swagger.getInfo();
  if (info == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  final String description = info.getDescription();
  if (description == null) {
    return super.determineConnectorDescription(connectorTemplate, connectorSettings);
  }
  return description;
}

代码示例来源:origin: amazon-archives/aws-apigateway-importer

@Override
public String createApi(Swagger swagger, String name) {
  this.swagger = swagger;
  this.processedModels.clear();
  final RestApi api = createApi(getApiName(swagger, name), swagger.getInfo().getDescription());
  LOG.info("Created API "+api.getId());
  
  try {
    final Resource rootResource = getRootResource(api).get();
    deleteDefaultModels(api);
    createModels(api, swagger.getDefinitions(), swagger.getProduces());
    createResources(api, rootResource, swagger.getBasePath(), swagger.getProduces(), swagger.getPaths(), true);
  } catch (Throwable t) {
    LOG.error("Error creating API, rolling back", t);
    rollback(api);
    throw t;
  }
  return api.getId();
}

相关文章