Search in sources :

Example 1 with NoGetOperationsFilter

use of io.swagger.v3.core.filter.resources.NoGetOperationsFilter in project swagger-core by swagger-api.

the class SpecFilterTest method filterAwayGetOperations.

@Test(description = "it should filter away get operations in a resource")
public void filterAwayGetOperations() throws IOException {
    final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
    final NoGetOperationsFilter filter = new NoGetOperationsFilter();
    final OpenAPI filtered = new SpecFilter().filter(openAPI, filter, null, null, null);
    if (filtered.getPaths() != null) {
        for (Map.Entry<String, PathItem> entry : filtered.getPaths().entrySet()) {
            assertNull(entry.getValue().getGet());
        }
    } else {
        fail("paths should not be null");
    }
}
Also used : PathItem(io.swagger.v3.oas.models.PathItem) NoGetOperationsFilter(io.swagger.v3.core.filter.resources.NoGetOperationsFilter) OpenAPI(io.swagger.v3.oas.models.OpenAPI) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Test(org.testng.annotations.Test)

Aggregations

NoGetOperationsFilter (io.swagger.v3.core.filter.resources.NoGetOperationsFilter)1 OpenAPI (io.swagger.v3.oas.models.OpenAPI)1 PathItem (io.swagger.v3.oas.models.PathItem)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Test (org.testng.annotations.Test)1