Repository navigation
feat: add support for reading from Optionals with parameter customizers - #3370
Merged
bnasslahsen merged 1 commit intoOct 23, 2026
Merged
Conversation
Mattias-Sehlstedt
force-pushed
the
customizers-read-from-optional
branch
2 times, most recently
from
September 21, 2026 18:15
ddf4a91 to
7c6f82c
Compare
Mattias-Sehlstedt
force-pushed
the
customizers-read-from-optional
branch
from
September 21, 2026 19:55
7c6f82c to
b17f88b
Compare
Mattias-Sehlstedt
force-pushed
the
customizers-read-from-optional
branch
from
October 2, 2026 18:28
b17f88b to
7fae659
Compare
Mattias-Sehlstedt
force-pushed
the
customizers-read-from-optional
branch
from
October 2, 2026 19:20
7fae659 to
96fe42d
Compare
7 of 11 tasks
Mattias-Sehlstedt
force-pushed
the
customizers-read-from-optional
branch
from
October 23, 2026 16:44
96fe42d to
e95228e
Compare
bnasslahsen
added a commit
that referenced
this pull request
Oct 23, 2026
The type-use annotations of a parameter are passed as parameter annotations, which also drive the required detection: a value declared as Optional<@NotNull String> made the parameter required. Skip the annotations marking a value as required on the type wrapped in an Optional, as they constrain the value when present, and skip type-use annotations already declared on the parameter. Restore the formatting of the code left unchanged, add app277 to cover the optional parameter, and reword the changelog entry. See gh-3370 Signed-off-by: Badr NASS LAHSEN <badr.nasslahsen@gmail.com>
bnasslahsen
pushed a commit
that referenced
this pull request
Oct 23, 2026
ParameterCustomizer implementations can now read the type-use annotations of a parameter, including the ones declared on the value wrapped in an Optional. The annotations marking a value as required are not taken from inside an Optional, so that Optional<@NotNull String> stays optional. Backport of gh-3370 Signed-off-by: Badr NASS LAHSEN <badr.nasslahsen@gmail.com>
Collaborator
|
Thanks @Mattias-Sehlstedt! Merged with a follow-up, keeping your tests: the type-use annotations are passed as parameter annotations, which also drive the required detection, so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to #3331 but for the customizers that springdoc offer to interpret annotations to schema decoration.
Note that this only affects
ParameterCustomizers, and notPropertyCustomizers. This is because theModelResolvercurrently does not propagate any annotation within anOptional. I will investigate how to best achieve so that these annotation can also be propagated and then discovered in thePropertyCustomizer.