Skip to content

Add ability to interpret primary constructor arguments without annotations as not required properties #2122

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

Open
wants to merge 1 commit into
base: 6.16.x
Choose a base branch
from

Conversation

altro3
Copy link
Collaborator

@altro3 altro3 commented May 12, 2025

By config property micronaut.openapi.constructor-arguments-as-required

Fixed #2116

@altro3 altro3 requested review from graemerocher and sdelamo May 12, 2025 11:20
@altro3 altro3 added the type: improvement A minor improvement to an existing feature label May 12, 2025
@altro3
Copy link
Collaborator Author

altro3 commented May 12, 2025

@graemerocher @sdelamo I don't know why they initially did the opposite, that arguments in the primary constructor are mandatory. In general, this is not a correct interpretation, because the presence of an argument in the constructor does not make it mandatory, unless an explicit @NonNull annotation is specified.

But to make sure no one breaks anything, I added the ability to softly switch the interpretation of arguments without annotations for those who use this feature.

@anna-geller
Copy link

@altro3 big thanks for the PR, this will also solve the issue on our side at Kestra.

Hi @graemerocher @sdelamo, could you review the PR sometime soon-ish or ask some other maintainers? We're also blocked due to this issue. We're working on an SDK and due to this bug, our models are not correctly generated. We'd kindly appreciate it if you could get that reviewed and merged. Thanks so much in advance!

…tions as not required properties. By config property `micronaut.openapi.constructor-arguments-as-required`

Fixed micronaut-projects#2116
@altro3 altro3 force-pushed the nullable-arg-params branch from 220fe5a to cfcae7a Compare May 16, 2025 18:53
@altro3
Copy link
Collaborator Author

altro3 commented May 16, 2025

@graemerocher ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Property should be marked as Nullable by default
2 participants