Search in sources :

Example 6 with SwaggerDescriptor

use of io.gravitee.rest.api.service.swagger.SwaggerDescriptor in project gravitee-management-rest-api by gravitee-io.

the class SwaggerService_ParseTest method shouldParseSwaggerV3_yaml.

@Test
public void shouldParseSwaggerV3_yaml() throws IOException {
    PageEntity pageEntity = getPage("io/gravitee/rest/api/management/service/openapi.yaml", MediaType.TEXT_PLAIN);
    SwaggerDescriptor descriptor = swaggerService.parse(pageEntity.getContent(), false);
    assertNotNull(descriptor);
    validateV3(Yaml.mapper().readTree(descriptor.toYaml()));
}
Also used : PageEntity(io.gravitee.rest.api.model.PageEntity) SwaggerDescriptor(io.gravitee.rest.api.service.swagger.SwaggerDescriptor) Test(org.junit.Test)

Example 7 with SwaggerDescriptor

use of io.gravitee.rest.api.service.swagger.SwaggerDescriptor in project gravitee-management-rest-api by gravitee-io.

the class SwaggerService_ParseTest method shouldNotThrowAnythingWhenFailIfErrorsFalse_yaml.

@Test
public void shouldNotThrowAnythingWhenFailIfErrorsFalse_yaml() throws IOException {
    PageEntity pageEntity = getPage("io/gravitee/rest/api/management/service/swagger-v2-no-info-name.yaml", MediaType.APPLICATION_JSON);
    SwaggerDescriptor descriptor = swaggerService.parse(pageEntity.getContent());
    assertNotNull(descriptor);
}
Also used : PageEntity(io.gravitee.rest.api.model.PageEntity) SwaggerDescriptor(io.gravitee.rest.api.service.swagger.SwaggerDescriptor) Test(org.junit.Test)

Example 8 with SwaggerDescriptor

use of io.gravitee.rest.api.service.swagger.SwaggerDescriptor in project gravitee-management-rest-api by gravitee-io.

the class SwaggerService_ParseTest method shouldParseSwaggerV2_yaml.

@Test
public void shouldParseSwaggerV2_yaml() throws IOException {
    PageEntity pageEntity = getPage("io/gravitee/rest/api/management/service/swagger-v2.yaml", MediaType.TEXT_PLAIN);
    SwaggerDescriptor descriptor = swaggerService.parse(pageEntity.getContent(), false);
    assertNotNull(descriptor);
    validateV3(Yaml.mapper().readTree(descriptor.toYaml()), false);
}
Also used : PageEntity(io.gravitee.rest.api.model.PageEntity) SwaggerDescriptor(io.gravitee.rest.api.service.swagger.SwaggerDescriptor) Test(org.junit.Test)

Aggregations

SwaggerDescriptor (io.gravitee.rest.api.service.swagger.SwaggerDescriptor)8 Test (org.junit.Test)7 PageEntity (io.gravitee.rest.api.model.PageEntity)6 SwaggerDescriptorException (io.gravitee.rest.api.service.exceptions.SwaggerDescriptorException)1 OAIToAPIConverter (io.gravitee.rest.api.service.impl.swagger.converter.api.OAIToAPIConverter)1 OAIToAPIV2Converter (io.gravitee.rest.api.service.impl.swagger.converter.api.OAIToAPIV2Converter)1 ParseOptions (io.swagger.v3.parser.core.models.ParseOptions)1