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

Warn if using annotation methods which require OpenAPI 3.1 when output mode is set to OpenAPI 3.0 #30036

Open
Azquelt opened this issue Nov 1, 2024 · 1 comment

Comments

@Azquelt
Copy link
Member

Azquelt commented Nov 1, 2024

New annotation methods were added in MP OpenAPI 4.0 to support the new features added to OpenAPI 3.1. The majority are on @Schema, but there are more across the other annotations (e.g. Info.summary).

When the server is configured to output OpenAPI 3.0, the data contributed by these annotation methods will be dropped at the point that the document is output.

We should warn the user if they've used any of these new fields when the output mode is set to OpenAPI 3.0.

@Azquelt
Copy link
Member Author

Azquelt commented Nov 1, 2024

I think we should implement this by querying the Jandex index directly, looking for a hard-coded list of annotations and fields and warning if any of them are used.

This does have the downside that we'll only catch use of annotations and not of the model APIs from a reader or filter, but I think that's acceptable since annotations are more commonly used and users using the model directly are likely to have more knowledge of OpenAPI.

Another option would be to scan the model once it's serialized, looking for fields in the model, but this has two issues:

  • it will pick up any fields which were generated automatically by the OpenAPI implementation, rather than added deliberately by the user
  • it would be impossible to link the problem back to the code that caused it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant