Only top-level objects are validated

オープン
#77 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
openapi, python
領域
api, testing

調査の方向性

Start by tracing how required properties are validated for schemas nested inside array items and other object properties. Add regression cases matching the invalid array-item and nested-object examples, then verify validation rejects required names missing from properties while preserving the existing top-level behavior.

索引モデルが issue の本文から書いたものです。

説明

kind/bug/confirmed

Validation should fail when an object has an item in the required list that isn't defined in properties.

Validation fails as expected when an object is defined on the top level:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /my-pet:
    get:
      summary: A pet
      operationId: getPet
      tags:
        - pets
      responses:
        '200':
          description: A pet
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
components:
  schemas:
    Pet:
      type: object
      required:
        - name
        - undefinedRequiredItem # This item is not defined in properties, FAIL validation
      properties:
        name:
          type: string
> Required list has not defined properties: ['undefinedRequiredItem']

BUG: Validation passes for an invalid object used as an array item:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      responses:
        '200':
          description: Array of pets
          content:
            application/json:    
              schema:
                $ref: "#/components/schemas/Pets"
components:
  schemas:
    Pets:
      type: array
      items:
        type: object
        required:
          - name
          - undefinedRequiredItem # This item is not defined in properties, but validation passes
        properties:
          name:
            type: string
> OK

BUG: Validation passes for an invalid nested object:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /my-pet:
    get:
      summary: A pet
      operationId: getPet
      tags:
        - pets
      responses:
        '200':
          description: A pet
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
components:
  schemas:
    Pet:
      type: object
      properties:
        pet:
          type: object
          required:
            - name
            - undefinedRequiredItem # This item is not defined in properties, but validation passes
          properties:
            name:
              type: string
> OK
主要言語
Python
スター
409
フォーク
73
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-openapi/openapi-spec-validator のほかの issue

python-openapi/openapi-spec-validator の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。