当前位置: 首页>>代码示例>>Java>>正文


Java Swagger.getInfo方法代码示例

本文整理汇总了Java中io.swagger.models.Swagger.getInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Swagger.getInfo方法的具体用法?Java Swagger.getInfo怎么用?Java Swagger.getInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.swagger.models.Swagger的用法示例。


在下文中一共展示了Swagger.getInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: determineConnectorName

import io.swagger.models.Swagger; //导入方法依赖的package包/类
@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;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:17,代码来源:BaseSwaggerConnectorGenerator.java

示例2: testProcess

import io.swagger.models.Swagger; //导入方法依赖的package包/类
@Test
public void testProcess() {
  SwaggerGenerator swaggerGenerator = new SwaggerGenerator(Mockito.mock(SwaggerGeneratorContext.class),
      null);
  swaggerDefinitionProcessor.process(SwaggerTestTarget.class.getAnnotation(SwaggerDefinition.class),
      swaggerGenerator);

  Swagger swagger = swaggerGenerator.getSwagger();
  assertEquals(1, swagger.getTags().size());
  io.swagger.models.Tag tag = swagger.getTags().get(0);
  assertEquals("testTag", tag.getName());
  assertEquals("desc", tag.getDescription());
  assertEquals("testValue", tag.getExternalDocs().getDescription());
  assertEquals("testUrl", tag.getExternalDocs().getUrl());
  assertEquals("127.0.0.1", swagger.getHost());
  assertThat(swagger.getSchemes(), contains(io.swagger.models.Scheme.HTTP, io.swagger.models.Scheme.HTTPS));
  io.swagger.models.Info info = swagger.getInfo();
  assertEquals("title", info.getTitle());
  assertEquals("version", info.getVersion());
  assertEquals("desc", info.getDescription());
  assertEquals("contactName", info.getContact().getName());
  assertEquals("licenseName", info.getLicense().getName());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:24,代码来源:SwaggerDefinitionProcessorTest.java

示例3: determineConnectorDescription

import io.swagger.models.Swagger; //导入方法依赖的package包/类
@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;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:18,代码来源:BaseSwaggerConnectorGenerator.java

示例4: testSwaggerDefinition

import io.swagger.models.Swagger; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSwaggerDefinition() {
  SwaggerGenerator swaggerGenerator =
      new SwaggerGeneratorForTest(context, SwaggerAnnotation.class);
  swaggerGenerator.generate();

  Swagger swagger = swaggerGenerator.getSwagger();

  Assert.assertEquals(SwaggerAnnotation.class.getName(),
      swagger.getInfo().getVendorExtensions().get(SwaggerConst.EXT_JAVA_INTF));
  Assert.assertEquals("2.0", swagger.getSwagger());
  Assert.assertEquals("/base", swagger.getBasePath());
  Assert.assertEquals("host", swagger.getHost());
  Assert.assertEquals(Arrays.asList("json", "xml"), swagger.getConsumes());
  Assert.assertEquals(Arrays.asList("abc", "123"), swagger.getProduces());

  Assert.assertEquals(1, swagger.getTags().size());
  io.swagger.models.Tag tagA = swagger.getTags().get(0);
  Assert.assertEquals("tagA", tagA.getName());
  Assert.assertEquals("desc of tagA", tagA.getDescription());
  Assert.assertEquals("tagA ext docs", tagA.getExternalDocs().getDescription());
  Assert.assertEquals("url of tagA ext docs", tagA.getExternalDocs().getUrl());
  Assert.assertEquals(1, tagA.getVendorExtensions().size());

  Map<String, Object> tagValue = (Map<String, Object>) tagA.getVendorExtensions().get("x-tagA");
  Assert.assertEquals("value of tagAExt", tagValue.get("x-tagAExt"));

  io.swagger.models.Info info = swagger.getInfo();
  Assert.assertEquals("title of SwaggerAnnotation", info.getTitle());
  Assert.assertEquals("0.1", info.getVersion());
  Assert.assertEquals("termsOfService", info.getTermsOfService());
  Assert.assertEquals("description of info for SwaggerAnnotation", info.getDescription());

  Assert.assertEquals("contact", info.getContact().getName());
  Assert.assertEquals("[email protected]", info.getContact().getEmail());
  Assert.assertEquals("http://contact", info.getContact().getUrl());

  Assert.assertEquals("license ", info.getLicense().getName());
  Assert.assertEquals("http://license", info.getLicense().getUrl());

  Assert.assertEquals(2, info.getVendorExtensions().size());

  Map<String, Object> infoValue = (Map<String, Object>) info.getVendorExtensions().get("x-info");
  Assert.assertEquals("value of infoExt", infoValue.get("x-infoExt"));

  Assert.assertEquals("SwaggerAnnotation ext docs", swagger.getExternalDocs().getDescription());
  Assert.assertEquals("url of SwaggerAnnotation ext docs", swagger.getExternalDocs().getUrl());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:50,代码来源:TestSwaggerDefinition.java


注:本文中的io.swagger.models.Swagger.getInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。