use of io.swagger.v3.core.filter.resources.NoOpOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method cloneEverythingConcurrent.
@Test(description = "it should clone everything concurrently")
public void cloneEverythingConcurrent() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
ThreadGroup tg = new ThreadGroup("SpecFilterTest" + "|" + System.currentTimeMillis());
final Map<String, OpenAPI> filteredMap = new ConcurrentHashMap<>();
for (int i = 0; i < 10; i++) {
final int id = i;
new Thread(tg, "SpecFilterTest") {
public void run() {
try {
filteredMap.put("filtered " + id, new SpecFilter().filter(openAPI, new NoOpOperationsFilter(), null, null, null));
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
new Thread(new FailureHandler(tg, filteredMap, openAPI)).start();
}
use of io.swagger.v3.core.filter.resources.NoOpOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method retainNonBrokenReferenceModelComposedProperties.
@Test(description = "it should retain non-broken reference model composed properties")
public void retainNonBrokenReferenceModelComposedProperties() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_REFERRED_SCHEMAS);
assertNotNull(openAPI.getComponents().getSchemas().get("User"));
final NoOpOperationsFilter noOperationsFilter = new NoOpOperationsFilter();
OpenAPI filtered = new SpecFilter().filter(openAPI, noOperationsFilter, null, null, null);
assertNotNull(filtered.getComponents().getSchemas().get("User"));
final RemoveUnreferencedDefinitionsFilter refFilter = new RemoveUnreferencedDefinitionsFilter();
filtered = new SpecFilter().filter(openAPI, refFilter, null, null, null);
assertNotNull(filtered.getComponents().getSchemas().get("User"));
assertNotNull(filtered.getComponents().getSchemas().get("Pet"));
}
use of io.swagger.v3.core.filter.resources.NoOpOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method cloneWithoutModels.
@Test(description = "it should clone everything from JSON without models")
public void cloneWithoutModels() throws IOException {
final String json = ResourceUtils.loadClassResource(getClass(), RESOURCE_PATH_WITHOUT_MODELS);
final OpenAPI openAPI = Json.mapper().readValue(json, OpenAPI.class);
final OpenAPI filtered = new SpecFilter().filter(openAPI, new NoOpOperationsFilter(), null, null, null);
SerializationMatchers.assertEqualsToJson(filtered, json);
}
use of io.swagger.v3.core.filter.resources.NoOpOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method cloneEverything.
@Test(description = "it should clone everything")
public void cloneEverything() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
final OpenAPI filtered = new SpecFilter().filter(openAPI, new NoOpOperationsFilter(), null, null, null);
assertEquals(Json.pretty(filtered), Json.pretty(openAPI));
}
use of io.swagger.v3.core.filter.resources.NoOpOperationsFilter in project swagger-core by swagger-api.
the class SpecFilterTest method shouldContainAllTopLevelTags.
@Test(description = "it should contain all tags in the top level OpenAPI object")
public void shouldContainAllTopLevelTags() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_REFERRED_SCHEMAS);
final NoOpOperationsFilter filter = new NoOpOperationsFilter();
final OpenAPI filtered = new SpecFilter().filter(openAPI, filter, null, null, null);
assertEquals(getTagNames(filtered), Sets.newHashSet(PET_TAG, USER_TAG, STORE_TAG));
}
Aggregations