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

Implemented nullable fields for openapi spec generation #865

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

skytz
Copy link
Contributor

@skytz skytz commented Aug 15, 2024

I've added the ability to set nullable fields on a struct with poem_api::Object derive.

Following the spec here: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#fixed-fields-20

Either for each individual field, with nullable attibute, or at the struct level with nullable_all.

It also solves this opened issue: #701

@kidqueb
Copy link

kidqueb commented Oct 10, 2024

Gave this a shot and it worked great, thank you. Hopefully get this gets merged in soon.

Edit:
Revisiting, I get the limitation now. Trying to get it to set optional/nullable fields to Some(None) for null, Some(Some(T)) for the value and None when its completely omitted..

Edit edit:
Found MaybeUndefined and we're back to working great

@sunli829 sunli829 merged commit b16f72e into poem-web:master Nov 25, 2024
@sunli829
Copy link
Collaborator

thanks

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.

3 participants