use of io.swagger.v3.core.filter.resources.InternalModelPropertiesRemoverFilter in project swagger-core by swagger-api.
the class SpecFilterTest method filterWithNullDefinitions.
@Test(description = "it should filter with null definitions")
public void filterWithNullDefinitions() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
openAPI.getComponents().setSchemas(null);
final InternalModelPropertiesRemoverFilter filter = new InternalModelPropertiesRemoverFilter();
final OpenAPI filtered = new SpecFilter().filter(openAPI, filter, null, null, null);
assertNotNull(filtered);
}
use of io.swagger.v3.core.filter.resources.InternalModelPropertiesRemoverFilter in project swagger-core by swagger-api.
the class SpecFilterTest method filterAwayInternalModelProperties.
@Test(description = "it should filter away internal model properties")
public void filterAwayInternalModelProperties() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
final InternalModelPropertiesRemoverFilter filter = new InternalModelPropertiesRemoverFilter();
final OpenAPI filtered = new SpecFilter().filter(openAPI, filter, null, null, null);
for (Map.Entry<String, Schema> entry : filtered.getComponents().getSchemas().entrySet()) {
for (String propName : (Set<String>) entry.getValue().getProperties().keySet()) {
assertFalse(propName.startsWith("_"));
}
}
}
Aggregations