Skip to content

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

Description

@svetlyak40wt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions