Skip to content

Add OpenApi annotations to resources#311

Merged
EricWittmann merged 2 commits into
Apitomy:mainfrom
mcruzdev:issue-309
Feb 28, 2025
Merged

Add OpenApi annotations to resources#311
EricWittmann merged 2 commits into
Apitomy:mainfrom
mcruzdev:issue-309

Conversation

@mcruzdev
Copy link
Copy Markdown
Contributor

@mcruzdev mcruzdev commented Feb 25, 2025

Added

  • New property for disabling or not the generation of Microprofile OpenAPI annotations.

Changed

By default all generated resources contains OpenAPI annotations.

Closes #309

@mcruzdev
Copy link
Copy Markdown
Contributor Author

cc: @EricWittmann

@EricWittmann
Copy link
Copy Markdown
Contributor

Cool! Although what is the utility of having open API annotations on code that was generated from a specification? Typically open API annotations are useful to document code when using a code first approach.

@mcruzdev
Copy link
Copy Markdown
Contributor Author

mcruzdev commented Feb 25, 2025

It is a good question, I think to render a swagger exposed through HTML.

I know that the user can use the OpenAPI specification file to expose the beautiful HTML, but to add again, avoid the need to write code.

@EricWittmann
Copy link
Copy Markdown
Contributor

OK thanks - that was the only use-case I could think of, and I was wondering if you had some other need in mind.

I do think that most users would simply include the openapi spec in the application for this purpose, but it's also true that there may not be a 1-1 mapping between the spec and the resulting generated JAX-RS code. So I can see a motivation to want a new openapi spec generated from the code, which would perhaps (in some cases) be more technically accurate for API consumers.

@mcruzdev
Copy link
Copy Markdown
Contributor Author

I agree with you and I do no have another need in mind for now... It was a feature request from Quarkus OpenApi Generator extension.

@mcruzdev
Copy link
Copy Markdown
Contributor Author

mcruzdev commented Feb 26, 2025

I am out today (at work) when I got my laptop I will fix this error.

@EricWittmann
Copy link
Copy Markdown
Contributor

Today's churn has resulted in conflicts, sorry about that. I renamed _OpenApi2JaxRs to quarkus to avoid issues with loading resources.

@mcruzdev
Copy link
Copy Markdown
Contributor Author

I am fixing here, in the future (maybe) we can remove the expected dirs for Java 11

@mcruzdev
Copy link
Copy Markdown
Contributor Author

Done @EricWittmann, ty!

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.

Add @Operation to generated resource

2 participants