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

feat: add example for oneOf response, fix custom schema usage #147

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

danielgtaylor
Copy link
Owner

This PR adds an example showing how you can return different responses depending on some input param while providing a oneOf schema in the OpenAPI for the operation.

It includes a small fix to make sure not to overwrite custom schemas, if set.

Fixes #35. In the future such functionality could be wrapped in a nicer way, but for now this lays the groundwork to make the feature possible. PRs to add high-level utilities around it are welcome.

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
huma.go 82.25% <100.00%> (+0.07%) ⬆️

📢 Thoughts on this report? Let us know!.

@danielgtaylor danielgtaylor merged commit fb69658 into main Oct 20, 2023
5 checks passed
@danielgtaylor danielgtaylor deleted the oneof-response branch October 20, 2023 23: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.

Support for multiple response objects?
1 participant