Redesign the per-application OpenAPI processing #3615
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3587
Instead of choosing which classes to include in the annotation scanning by SmallRye for each individual JAX-RS application (which previously overlooked POJO classes used as input or output parameter types to the endpoints) , this new approach identifies which classes to exclude instead.
The logic is described in the updated JavaDoc in
MPOpenAPIBuilder
.This PR also removes the beans.xml from
helidon-microprofile-server
. It is not needed, and it was causing a rogue synthetic JAX-RS Application to be incorrectly instantiated early in the prep for jlink/native-image.Further, an apparent flaw in the MP OpenAPI TCK tests expects that an
Application
which returns a non-empty set fromgetSingletons
but an empty set fromgetClasses
will also expose endpoints from other resource classes not implied bygetSingletons
. This requires the OpenAPI document to contradict the actual server behavior in Helidon and, as it turns out, OpenLiberty. Both servers' behavior follows the JAX-RS spec https://jakarta.ee/specifications/restful-ws/3.0/jakarta-restful-ws-spec-3.0.html#servlet, even though MP does not support servlets per se. This PR introduces a config property which controls the JAX-RS semantics for OpenAPI processing (defaults to true) and sets it to false only for the TCK run. Presumably a future MP OpenAPI release will fix the TCK tests and we can remove this then.