Skip to content

feat: discriminator#459

Open
etodanik wants to merge 1 commit intoopen-rpc:masterfrom
etodanik:feat/discriminator
Open

feat: discriminator#459
etodanik wants to merge 1 commit intoopen-rpc:masterfrom
etodanik:feat/discriminator

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