use of io.swagger.v3.core.filter.resources.NoPetOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method filterAwayPetResource.
@Test(description = "it should filter away the pet resource")
public void filterAwayPetResource() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
final NoPetOperationsFilter filter = new NoPetOperationsFilter();
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().getDelete());
assertNull(entry.getValue().getPost());
assertNull(entry.getValue().getPut());
assertNull(entry.getValue().getGet());
assertNull(entry.getValue().getHead());
assertNull(entry.getValue().getOptions());
}
} else {
fail("paths should not be null");
}
}
use of io.swagger.v3.core.filter.resources.NoPetOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method shouldNotContainTopLevelUserTags.
@Test(description = "it should not contain user tags in the top level OpenAPI object")
public void shouldNotContainTopLevelUserTags() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_REFERRED_SCHEMAS);
final NoPetOperationsFilter filter = new NoPetOperationsFilter();
final OpenAPI filtered = new SpecFilter().filter(openAPI, filter, null, null, null);
assertEquals(getTagNames(filtered), Sets.newHashSet(USER_TAG, STORE_TAG));
}
Aggregations