Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Does openapi-core include support for discriminator

Open
#176 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
openapi, python
Domain
api

Research direction

Start with the OpenAPI 3.0.1 Discriminator Object specification and reproduce the provided request-body schema using oneOf, user, admin, and item_type. Determine whether openapi-core currently selects the referenced schema from item_type; done means the support status and any required behavior are established for this example.

Written by the indexing model from the issue text.

Description

kind/question

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

Dominant language
Python
Stars
368
Forks
140
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-openapi/openapi-core

All issues in python-openapi/openapi-core

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.