-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Clarify oneOf usage if any #278
Comments
Welcome to OpenRPC! Thank you for taking the time to create an issue. Please review the guidelines |
Having the same issue as described by @antoine-mulet. |
@antoine-mulet @georgeconstantinou Thank you both for raising this issue. It's something we experimented with early on and dropped, but as pointed out, we missed a reference to it in the spec. Anything referring to oneOf should be removed. Polymorphism as described should be pushed down to the JSON schema, since it already fully supports oneOf. PRs are very welcomed. I'll make one later on today though. |
@antoine-mulet since it's ultimately your contribution, if you want to copy the PR and re-open, I'm happy to merge yours. |
@BelfordZ Thanks for the clarification and your great work! My PR is all yours. |
## [1.2.6](1.2.5...1.2.6) (2020-05-22) ### Bug Fixes * schema required formatting ([1a745b5](1a745b5)) * **method.paramStructure:** add spec detailing by-name case of cd.name ([646978c](646978c)) * [@BelfordZ](https://github.com/belfordz) edits for awesomeness ([cbae9e3](cbae9e3)) * add another oxford comma ([b1092f6](b1092f6)) * append 's' to param_s_ field ([9da993b](9da993b)) * formatting of required on linkObject.name ([63f5410](63f5410)) * missing oxford comma ([df8a507](df8a507)) * non-oxfordian missing space after oxfordian comma ([1deef5c](1deef5c)) * remove oneOf ([215b0ae](215b0ae)), closes [#278](#278) * remove unused dev deps ([11df1e8](11df1e8)) * s/field/value ([75275e6](75275e6)) * update FAQ and add to repo ([7c7310c](7c7310c)), closes [#283](#283)
🎉 This issue has been resolved in version 1.2.6 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
I have been struggling to understand how oneOf can be used within params since it is mentioned in the documentation https://spec.open-rpc.org/#method-object. I have played a bit with the playground as well and the only way I found to make use of oneOf was inside the schema, which is standard json schema. Am I missing something?
I found issue #193 which was auto closed so I am wondering whether oneOf was somehow supported in the past but it's not anymore? If that's the case the documentation should probably be updated.
As a side note I can see a use case where one could want to use oneOf outside the schema. This would be to define some sort of polymorphic group of top level params e.g.
This is clearly not compatible with params being of type array so not sure the added complexity is worth the benefits but I am currently migrating an API to OpenRPC and I found myself in the need of doing something like this so maybe others would too.
This limitation is easily overcome by introducing another level of nesting as follow but it ultimately changes what your API looks like
I hope it makes sense.
The text was updated successfully, but these errors were encountered: