Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign the per-application OpenAPI processing #3615

Merged
merged 3 commits into from
Nov 4, 2021
Merged

Redesign the per-application OpenAPI processing #3615

merged 3 commits into from
Nov 4, 2021

Conversation

tjquinno
Copy link
Member

@tjquinno tjquinno commented Nov 4, 2021

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 from getSingletons but an empty set from getClasses will also expose endpoints from other resource classes not implied by getSingletons. 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.

@tjquinno tjquinno self-assigned this Nov 4, 2021
@tomas-langer
Copy link
Member

Please create a follow up issue to remove this work around once the MP spec TCK is fixed and link it to MP issue. Thanks a lot!

@tjquinno tjquinno merged commit c98f873 into helidon-io:master Nov 4, 2021
@tjquinno tjquinno deleted the openapi-multiple-apps branch November 4, 2021 17:33
@tjquinno tjquinno added this to the 2.4.1 milestone Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect OpenAPI output in MP app with multiple Application classes
2 participants