membrane / api-gateway

API gateway for REST, OpenAPI, GraphQL and SOAP written in Java.
https://membrane-api.io
Apache License 2.0
448 stars 138 forks source link

Only add OpenAPI Interceptors when there is a Spec for APIProxy #1103

Closed predic8 closed 1 month ago

predic8 commented 1 month ago
private void initOpenAPI() throws IOException, ClassNotFoundException {
    if (specs.isEmpty())
        return;

    apiRecords = new OpenAPIRecordFactory(router).create(specs);

    checkForDuplicatePaths();

    basePaths = getOpenAPIMap();
    configureBasePaths();

    // @TODO only add if there are OpenAPI Specs
    interceptors.add(new OpenAPIPublisherInterceptor(apiRecords));
    interceptors.add(new OpenAPIInterceptor(this, router));
}