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

utopia-gen: Adjust params code to not set nullable on Option for Query params #1248

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

Turbo87
Copy link
Contributor

@Turbo87 Turbo87 commented Dec 19, 2024

This PR resolves #1215 by ensuring that Option<_> usage in Query params is not transformed into a nullable feature.

https://swagger.io/docs/specification/v3_0/describing-parameters/#default-parameter-values gives an example on how required: false query parameters are described and there is no nullable: true or schema.type: null in there, which indicates that required: false should be sufficient to describe an Option<_> type for query parameters.

(Potentially) Related:

@Turbo87 Turbo87 force-pushed the nullable-query branch 3 times, most recently from dceca68 to 023df0b Compare December 19, 2024 12:30
@juhaku
Copy link
Owner

juhaku commented Dec 19, 2024

https://swagger.io/docs/specification/v3_0/describing-parameters/#default-parameter-values gives an example on how required: false query parameters are described and there is no nullable: true or schema.type: null in there, which indicates that required: false should be sufficient to describe an Option<_> type for query parameters.

Although this spec is for OpenAPI 3.0 and not for OpenAPI 3.1.x it is probably right to expect that Option<T> query parameters should not be nullable but only required: false. Except in case of complex query parameters via content but they are not supported as of yet. #620

@Turbo87
Copy link
Contributor Author

Turbo87 commented Dec 19, 2024

Although this spec is for OpenAPI 3.0 and not for OpenAPI 3.1.x

yeah, unfortunately I couldn't find an equivalent example in the 3.1 spec, but given the validator results in #1215 I guess it's a safe assumption

Copy link
Owner

@juhaku juhaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems solid to me, 👍 Same here just a CHANGELOG.md entry probably under Changed category

@Turbo87
Copy link
Contributor Author

Turbo87 commented Dec 19, 2024

Same here just a CHANGELOG.md entry probably under Changed category

done :)

Copy link
Owner

@juhaku juhaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set the ball rolling and merge it to master 🙂

@juhaku juhaku merged commit de536e4 into juhaku:master Dec 19, 2024
12 checks passed
@Turbo87 Turbo87 deleted the nullable-query branch December 22, 2024 12:08
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.

Query params should not be nullable
2 participants