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

Not dropping too many null values in OpenAPI encoders #207

Merged
merged 8 commits into from
Jan 27, 2025

Conversation

ghik
Copy link
Contributor

@ghik ghik commented Jan 25, 2025

Fixes #206

@ghik
Copy link
Contributor Author

ghik commented Jan 26, 2025

@adamw I realized that there are other pitfalls - even dropping null field values recursively is not safe, because the OpenAPI may contain objects that must be retained verbatim, e.g. an example value in a schema with null-valued fields.

To me the right approach seems to drop null fields carefully and separately (and non-recursively) in each encoder. I've updated the PR to do that.

@ghik ghik changed the title OpenAPI encoder no longer drops null array elements Not dropping too many null field values in OpenAPI encoders Jan 26, 2025
@ghik ghik changed the title Not dropping too many null field values in OpenAPI encoders Not dropping too many null values in OpenAPI encoders Jan 26, 2025
@adamw
Copy link
Member

adamw commented Jan 27, 2025

Thanks for the changes :) Some tests are failing now, though

@ghik
Copy link
Contributor Author

ghik commented Jan 27, 2025

@adamw all seems green now :)

@adamw adamw merged commit 73077e7 into softwaremill:master Jan 27, 2025
3 checks passed
@adamw
Copy link
Member

adamw commented Jan 27, 2025

Awesome, 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.

OpenAPI JSON encoder removes null values from lists
2 participants