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: discriminator #459

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

etodanik
Copy link

@etodanik etodanik commented Feb 3, 2024

I'm proposing adding a discriminator similar to the OpenAPI discriminator feature:
https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/

This would address the following feature requests: open-rpc/spec#382 open-rpc/spec#367

And in general be predictable for anyone who worked with OpenAPI before coming to OpenRPC.

The main use case is code generation of API clients in cases where a method might return more than one type of value based on parameters passed.

Small disclaimer:
I think my use of allOf should compile correctly? But if not, upon conceptual agreement from maintainers I'm willing to make sure everything works as intended, as well as potentially introduce proper support for this in the playground.

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.

1 participant