OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.14k stars 587 forks source link

OpenAPI error when reader configuration property set in bootstrap.properties #15765

Open jpfloresibm opened 3 years ago

jpfloresibm commented 3 years ago

Describe the bug When the configuration properties for the open api reader are provided in the bootstrap properties, the following error is observed:

[2/1/21 9:23:00:987 PST] 0000003f com.ibm.ws.microprofile.openapi.utils.OpenAPIUtils           E CWWKO1658E: Failed to load the OpenAPI model reader class: com.ibm.mdmx.openapi.extension.reader.IAMSecurityOpenAPIReader.

However if the configuration is provided in the microprofile-config.properties, the error is not generated.

Steps to Reproduce Create a custom OpenApiReader implementation and define it in the bootstrap.properties file. Start up WLP. Observe messages.log for the following error: CWWKO1658E

Expected behavior The CWWKO1658E error should not be generated when the config is provided in the bootstrap.properties.

Diagnostic information:

Additional context Add any other context about the problem here.

Emily-Jiang commented 3 years ago

@jpfloresibm From the files you attached, it seems that you are trying to use MP Open API. However, in your server.xml, you didn't list the feature mpOpenAPI-1.1. Please try again by adding <feature>mpOpenAPI-1.1</feature> to your server.xml.

jpfloresibm commented 3 years ago

After trying the mpOpenAPI-1.1 feature the issue still persists. Note that this is only happening if the config is defined via bootstrap.properties (the class still loads and the extra markup is seen in the api explorer page but the error message is showing up). If defined in the microprofile-config.properties the error message is not generated.

jpfloresibm commented 3 years ago

Hi guys. Any updates on this?

Emily-Jiang commented 3 years ago

@arturdzm can you investigate this and provide a update?

jpfloresibm commented 3 years ago

@arthurdm @Emily-Jiang are there any updates to this bug? Are service logs keep generating these errors and would be nice to put in a fix for this issue.

arthurdm commented 3 years ago

@arturdzm - fyi ^

Azquelt commented 3 years ago

I think there are two things happening here:

openapi-3.1 reads the config from bootstrap.properties and tries to load the configured OpenAPIReader from the internal web module, which does not have a class by that name.

@arturdzm I think we may just need to add additional context routes to the ignore list in OpenAPIModuleListener. Does that seem right?

jpfloresibm commented 1 year ago

hi @Azquelt has there been any progress on this bug? We still keep seeing it on version 21.0.0.10

Azquelt commented 1 year ago

No, @arturdzm is the person who owns it, I'll follow up with him.

InhexSTER commented 1 year ago

@Azquelt I agree.

the bootstrap.properties is used for all applications, so configuration is applied to all WebModules. Each application can have it's own reader, it's own fitler, exclude package, etc. So, logically these settings should only be inside each application's microprofile-config.properties and not in bootstrap or system property level.

The list of properties here is really meant as application setting https://download.eclipse.org/microprofile/microprofile-open-api-1.1.2/microprofile-openapi-spec.html#_core_configurations

There are few properties that are global for openapi-3.1 and could be in bootstrap.properties feature such as : mp.openapi.extensions.liberty.public.url=myAPI