private void filterComponents()

in geronimo-openapi-impl/src/main/java/org/apache/geronimo/microprofile/openapi/impl/filter/FilterImpl.java [104:149]


    private void filterComponents(final  Components components) {
        ofNullable(components.getCallbacks()).ifPresent(this::filterCallbacks);
        ofNullable(components.getHeaders())
                .ifPresent(headers ->
                        headers.entrySet().stream()
                                .filter(it -> delegate.filterHeader(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(headers::remove));
        ofNullable(components.getLinks()).ifPresent(this::filterLinks);
        ofNullable(components.getParameters())
                .ifPresent(parameters ->
                        parameters.entrySet().stream()
                                .filter(it -> delegate.filterParameter(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(parameters::remove));
        ofNullable(components.getRequestBodies())
                .ifPresent(requestBodies ->
                        requestBodies.entrySet().stream()
                                .filter(it -> delegate.filterRequestBody(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(requestBodies::remove));
        ofNullable(components.getResponses())
                .ifPresent(responses ->
                        responses.entrySet().stream()
                                .filter(it -> delegate.filterAPIResponse(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(responses::remove));
        ofNullable(components.getSchemas())
                .ifPresent(schemas ->
                        schemas.entrySet().stream()
                                .filter(it -> delegate.filterSchema(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(schemas::remove));
        ofNullable(components.getSecuritySchemes())
                .ifPresent(schemes ->
                        schemes.entrySet().stream()
                                .filter(it -> delegate.filterSecurityScheme(it.getValue()) == null)
                                .map(Map.Entry::getKey)
                                .collect(toList())
                                .forEach(schemes::remove));
    }