这是indexloc提供的服务,不要输入任何密码
Skip to content

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
@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?

2 participants