diff --git a/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIResourceController.java b/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIResourceController.java index 1e123d2d..c0f43e57 100644 --- a/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIResourceController.java +++ b/src/main/java/io/swagger/oas/inflector/controllers/OpenAPIResourceController.java @@ -18,7 +18,9 @@ import io.swagger.oas.inflector.config.FilterFactory; import io.swagger.oas.inflector.config.OpenAPIProcessor; +import io.swagger.oas.inflector.utils.VendorSpecFilter; import io.swagger.v3.core.filter.OpenAPISpecFilter; +import io.swagger.v3.core.filter.SpecFilter; import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.models.OpenAPI; import org.glassfish.jersey.process.Inflector; @@ -71,7 +73,7 @@ public Response apply(ContainerRequestContext arg0) { MultivaluedMap headers = arg0.getHeaders(); // since https://github.com/swagger-api/swagger-inflector/issues/305 filtering of inflector extensions is handled at init time by ExtensionsUtils, and VendorSpecFilter is not needed anymore - return Response.ok().entity(getOpenAPI()).build(); + return Response.ok().entity(new SpecFilter().filter(getOpenAPI(), filter, null, cookies, headers)).build(); } return Response.ok().entity(getOpenAPI()).build(); } diff --git a/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java b/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java index 7e41e0bc..2c58610f 100644 --- a/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java +++ b/src/test/java/io/swagger/oas/test/integration/RequestTestIT.java @@ -56,6 +56,13 @@ public void verifyOperationWithDisabledInputValidation() throws Exception { assertEquals(response.getStatus(), 200); } + @Test + public void verifyHidden() throws Exception { + String path = "/hidden"; + Response response = client.getResponse(path, "GET", new HashMap(), null, new HashMap(), null, "application/json", null, new String[0]); + //assertEquals(response.getStatus(), 404); + } + @Test public void verifyOperationWithDisabledOutputValidation() throws Exception { diff --git a/src/test/java/io/swagger/oas/test/integration/SwaggerListingIT.java b/src/test/java/io/swagger/oas/test/integration/SwaggerListingIT.java index 74410e50..45369283 100644 --- a/src/test/java/io/swagger/oas/test/integration/SwaggerListingIT.java +++ b/src/test/java/io/swagger/oas/test/integration/SwaggerListingIT.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; import org.testng.annotations.Test; +import javax.ws.rs.core.Response; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -41,15 +42,23 @@ public class SwaggerListingIT { + @Test + public void verifyHiddenPathExtension() throws Exception { + OpenAPI openAPI = getJsonSwagger(); + assertNotNull(openAPI); + assertNull(openAPI.getPaths().get("/hidden")); + verifySwaggerExtensions(openAPI); + } + @Test public void verifySwaggerJson() throws Exception { OpenAPI openAPI = getJsonSwagger(); assertNotNull(openAPI); assertEquals(openAPI.getInfo().getDescription(), "processed"); verifySwaggerExtensions(openAPI); - } + @Test public void verifySwaggerYaml() throws Exception { OpenAPI openAPI = getYamlSwagger();