Skip to content

Conversation

T3rm1
Copy link
Contributor

@T3rm1 T3rm1 commented Nov 22, 2024

This PR keeps properties as optional when they are annotated with one of the not-null annoatations and have a value in their groups attribute.
The groups attribute lets you define under which circumstances the annotation is evaluated. For NotNull this means, the field can be optional in some cases and mandatory in other cases.
Since we don't know what should apply, the parameter should be considered optional.

@frantuma It would greatly help me if we could merge this asap. I tried a few workarounds but none are fully working.

@mc1arke
Copy link

mc1arke commented Dec 9, 2024

For reference: I've duplicate the concept in #4805 as I'd only checked for open issues, not PRs. My solution allows the calling code to override the filtering so that certain groups can be treated as being mandatory where required, and I think this solution PR is missing annotation on method parameters for JAXRS - see io.swagger.v3.core.util.ParameterProcessor making a call to io.swagger.v3.core.jackson.ModelResolver#NOT_NULL_ANNOTATIONS.

@T3rm1
Copy link
Contributor Author

T3rm1 commented Dec 9, 2024

I think this solution PR is missing annotation on method parameters for JAXRS

You might be right. I'll take a look.

@didjoman
Copy link

Hi,
I think it would be a nice improvement as the @NotNull is not well handled with groups currently.

But just so that you know, there is also this pull-request that seemed to have implemented groups 2 years ago:
#4246
However I don't know what it is worse now, as it was not updated...

Anyway, I think any fix on that subject would be very much appreciated. It would fix a lot of issues/questions raised by the community as we can see in the other PR.

@frantuma What is your opinion on this issue ?

@frantuma
Copy link
Contributor

frantuma commented Apr 7, 2025

This has been replaced by #4853

@frantuma frantuma closed this Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants