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

Does OpenRPC supports something like "discriminator" for oneOf and anyOf? #382

Open
svetlyak40wt opened this issue Aug 19, 2023 · 2 comments

Comments

@svetlyak40wt
Copy link

svetlyak40wt commented Aug 19, 2023

OpenAPI supports it and this feature is useful when writing code-generated API wrappers.

Here is how it looks like in the OpenAPI spec:

components:
  responses:
    sampleObjectResponse:
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Object1'
              - $ref: '#/components/schemas/Object2'
              - $ref: 'sysObject.json#/sysObject'
            discriminator:
              propertyName: objectType
              mapping:
                obj1: '#/components/schemas/Object1'
                obj2: '#/components/schemas/Object2'
                system: 'sysObject.json#/sysObject'

Example was taken from here.

@github-actions
Copy link

Welcome to OpenRPC! Thank you for taking the time to create an issue. Please review the guidelines

@etodanik
Copy link

etodanik commented Feb 3, 2024

This is similar to an earlier request:
#357

Would be great to hear which path maintainers prefer so someone could cook up a PR

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