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

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

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

OpenAPI.setInfo介绍

暂无

代码示例

代码示例来源: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

AnnotationsUtils.getInfo(openAPIDefinition.info()).ifPresent(info -> openAPI.setInfo(info));

代码示例来源:origin: com.atlassian.swagger/atlassian-swagger-doclet

public OpenAPI defaults(OpenAPI openAPI) {
    Info info = openAPI.getInfo();
    if (info == null) {
      info = new Info();
      openAPI.setInfo(info);
    }
    if (isEmpty(info.getTitle())) {
      info.setTitle("API");
    }
    if (isEmpty(info.getVersion())) {
      info.setTitle("1.0");
    }
    return openAPI;
  }
}

代码示例来源:origin: com.atlassian.swagger/atlassian-swagger-doclet

public Info info() {
  if (openAPI().getInfo() == null) {
    openAPI().setInfo(new Info());
  }
  return openAPI().getInfo();
}

代码示例来源:origin: noboomu/proteus

@SuppressWarnings("rawtypes")
protected void generateSpec() throws Exception
{
  Set<Class<?>> classes = this.registeredControllers;
  OpenAPIExtensions.setExtensions(Collections.singletonList(new ServerParameterExtension()));
  OpenAPI openApi = new OpenAPI();
  Info info = mapper.convertValue(openAPIConfig.getValue("info").unwrapped(), Info.class);
  openApi.setInfo(info);
  Map<String, SecurityScheme> securitySchemes = mapper.convertValue(    openAPIConfig.getValue("securitySchemes").unwrapped(),new TypeReference<Map<String, SecurityScheme>>(){});
  if (openApi.getComponents() == null)
  {
    openApi.setComponents(new Components());
  }
  openApi.getComponents().setSecuritySchemes(securitySchemes);
  List<Server> servers = mapper.convertValue(openAPIConfig.getValue("servers").unwrapped(), new TypeReference<List<Server>>(){});
  openApi.setServers(servers);
  SwaggerConfiguration config = new SwaggerConfiguration().resourceClasses(classes.stream().map(Class::getName).collect(Collectors.toSet())).openAPI(openApi);
  config.setModelConverterClassess(Collections.singleton(ServerModelResolver.class.getName()));
  OpenApiContext ctx = new GenericOpenApiContext().openApiConfiguration(config)
      .openApiReader(new Reader(config))
      .openApiScanner(new JaxrsApplicationAndAnnotationScanner().openApiConfiguration(config))
      .init();
  openApi = ctx.read();
  this.openApi = openApi;
  this.spec = writer.writeValueAsString(openApi);
}

代码示例来源:origin: org.mycore/mycore-restapi

private void setupOAS() {
  OpenAPI oas = new OpenAPI();
  Info oasInfo = new Info();
  oas.setInfo(oasInfo);
  oasInfo.setVersion(MCRCoreVersion.getVersion());
  oasInfo.setTitle(getApplicationName());

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

if (obj != null) {
  Info info = getInfo(obj, "info", result);
  openAPI.setInfo(info);

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

if (obj != null) {
  Info info = getInfo(obj, "info", result);
  openAPI.setInfo(info);

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

if (obj != null) {
  Info info = getInfo(obj, "info", result);
  openAPI.setInfo(info);

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

configuration.getOpenAPI().setInfo(oas.getInfo());

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

configuration.getOpenAPI().setInfo(oas.getInfo());

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

AnnotationsUtils.getInfo(openAPIDefinition.info()).ifPresent(info -> openAPI.setInfo(info));

代码示例来源:origin: noboomu/proteus

AnnotationsUtils.getInfo(openAPIDefinition.info()).ifPresent(info -> openAPI.setInfo(info));

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

openAPI.setInfo(convert(swagger.getInfo()));

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

openAPI.setInfo(convert(swagger.getInfo()));

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

openAPI.setInfo(convert(swagger.getInfo()));

相关文章