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

Support for multiple return types #514

Closed
Jefftree opened this issue Oct 12, 2022 · 5 comments
Closed

Support for multiple return types #514

Jefftree opened this issue Oct 12, 2022 · 5 comments

Comments

@Jefftree
Copy link

Is there any plan to support an endpoint capable of returning multiple return types? Eg: a ws.Route(...).Writes(TypeA{}}, TypeB{})

@emicklei
Copy link
Owner

can you explain the usecase? does the OpenAPI also support this?

@Jefftree
Copy link
Author

OpenAPI V3 supports returning a oneOf (https://swagger.io/specification/#discriminator-object). Kubernetes has endpoints that could return one of multiple values and I think it'd be useful if the WebService object could express that as well.

@emicklei
Copy link
Owner

thanks @Jefftree , I will look into the required changes

@emicklei
Copy link
Owner

@Jefftree , did you have a look at the PR?

@Jefftree
Copy link
Author

Thanks for the addition, will test it out this week but marking this as closed for now.

emicklei added a commit that referenced this issue Aug 5, 2023
* allow multiple samples for Write, issue #514

* update changelog

* chore: example handling request parameters with httpin (#518)

* use path package to join slash fragments #519 (#520)

* update hist

* update example openapi to use 3.10.1

* Add test for client request with and without trailing slash. (#522)

* Add test for client request with and without trailing slash.

* Correction.

* introduce MergePathStrategy

* Revert "introduce MergePathStrategy"

This reverts commit 709cf80.

* introduce MergePathStrategy for #521 #519 (#523)

* introduce MergePathStrategy for #521 #519

* update readme, set default to new strategy, add extra test

* link to security issue

* update change hist

* add hello world with TrimSlashStrategy

* two route example

* examples to show differences #519

* more route examples #519

* add examples for issue519 with path in root

* remove obsolete swagger example

* Update README.md

remover swagger12 mention

* allow multiple samples for Write, issue #514

---------

Co-authored-by: Ggicci <ggicci.t@gmail.com>
Co-authored-by: Gerrit <Gerrit91@users.noreply.github.com>
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

No branches or pull requests

2 participants