meta-schema
meta-schema copied to clipboard
feat: discriminator
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: https://github.com/open-rpc/spec/issues/382 https://github.com/open-rpc/spec/issues/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.