Search in sources :

Example 21 with SpecFilter

use of io.swagger.core.filter.SpecFilter in project swagger-core by swagger-api.

the class SpecFilterTest method retainModelsReferencesFromAdditionalProperties.

@Test(description = "Retain models referenced from additonalProperties")
public void retainModelsReferencesFromAdditionalProperties() throws IOException {
    final Swagger swagger = getSwagger("specFiles/additionalpropsmodel.json");
    final RemoveUnreferencedDefinitionsFilter remover = new RemoveUnreferencedDefinitionsFilter();
    final Swagger filtered = new SpecFilter().filter(swagger, remover, null, null, null);
    assertNotNull(filtered.getDefinitions().get("A"));
    assertNotNull(filtered.getDefinitions().get("B"));
}
Also used : Swagger(io.swagger.models.Swagger) SpecFilter(io.swagger.core.filter.SpecFilter) Test(org.testng.annotations.Test)

Aggregations

SpecFilter (io.swagger.core.filter.SpecFilter)21 Swagger (io.swagger.models.Swagger)21 Test (org.testng.annotations.Test)18 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)5 Map (java.util.Map)4 SwaggerSpecFilter (io.swagger.core.filter.SwaggerSpecFilter)3 Path (io.swagger.models.Path)3 ApiOperation (io.swagger.annotations.ApiOperation)2 Model (io.swagger.models.Model)2 Operation (io.swagger.models.Operation)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 SwaggerContextService (io.swagger.jaxrs.config.SwaggerContextService)1 ModelImpl (io.swagger.models.ModelImpl)1 Parameter (io.swagger.models.parameters.Parameter)1 IOException (java.io.IOException)1