Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Does openapi-core include support for discriminator

未關閉
#176 4 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
30/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
openapi, python
領域
api

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Python
星號
368
分支
140
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python-openapi/openapi-core 的其他 Issue

查看 python-openapi/openapi-core 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。