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

Support annotations on setters in addition to fields #285

Closed
EricWittmann opened this issue Apr 6, 2020 · 2 comments · Fixed by #293
Closed

Support annotations on setters in addition to fields #285

EricWittmann opened this issue Apr 6, 2020 · 2 comments · Fixed by #293
Assignees
Labels
bug Something isn't working
Milestone

Comments

@EricWittmann
Copy link
Contributor

Originally from here: quarkusio/quarkus#8415

OpenAPI Generated documentation for @BeanParam does not reflect the information coded in an @parameter annotation if you are using a setter.

It appears that you must annotate a member variable instead of a setter method with Both @QueryParam and @parameter in order for the API Doc to work properly. However, in our case, we are setting the value into a delegate and this workaround will not work for us.

I haven't confirmed this in SmallRye OpenAPI yet, but it seems likely to be an issue here.

@MikeEdgar
Copy link
Member

Yes, this is supposed to work. Reading the upstream issue in Quarkus, my best guess is that the @Parameter is missing the explicitly required fields called out in the JavaDoc (name and in) and it may be discarded. Earlier versions of SmallRye were more lenient on the requirement of those annotation properties, but it did cause issues (I forget what they were). It might be manageable to support those properties being omitted in this case since both annotations have the exact same target.

@MikeEdgar
Copy link
Member

It turns out that the scanner supports leaving out the name and in properties on the @Parameter annotation if there is another JAX-RS annotation on the same target and the target is not a method. I do not recall why it was coded that way and removing the requirement does not break any of the tests. I'll look at removing the limitation this week.

@MikeEdgar MikeEdgar added the bug Something isn't working label Apr 7, 2020
@MikeEdgar MikeEdgar self-assigned this Apr 7, 2020
@phillip-kruger phillip-kruger added this to the 1.2.2 milestone Apr 20, 2020
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue May 26, 2020
- Allow an omitted name to to match a specified name (supports case
where `@Parameter` has no `name` and equivalent JAX-RS annotation has a
name - see smallrye#285)
- Fix JavaDoc for FilteredIndexView
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue May 26, 2020
- Allow an omitted name to to match a specified name (supports case
where `@Parameter` has no `name` and equivalent JAX-RS annotation has a
name - see smallrye#285)
MikeEdgar added a commit to MikeEdgar/smallrye-open-api that referenced this issue May 26, 2020
- Allow an omitted name to to match a specified name (supports case
where `@Parameter` has no `name` and equivalent JAX-RS annotation has a
name - see smallrye#285)
- Fix JavaDoc for FilteredIndexView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants