Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Only top-level objects are validated

Aperta
#77 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
openapi, python
Ambito
api, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
409
Fork
73
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-openapi/openapi-spec-validator

Tutte le issue di python-openapi/openapi-spec-validator

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.