Skip to content

Does openapi-core include support for discriminator  #176

Open
@Origin1227

Description

@Origin1227

Hi , Does open-api core include support for discriminator
i tried it but didn't seem to work.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#discriminatorObject
if not any hints on how i could include it in my project


 components:
  requestBodies:
    object:
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/user'
              - $ref: '#/components/schemas/admin'
            discriminator:
              propertyName: item_type
  schemas:
    user:
      type: object
    admin:
      type: object

what i need is when the item_type is user in the request body it should be validated based on user schema and similarly for admin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions