allOf validation not working?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Riproduci la richiesta JSON PATCH verso /pets utilizzando il documento OpenAPI fornito e il riferimento allOf dello schema Cat a Pet. Traccia il modo in cui il validator risolve Pet e la relativa proprietà ereditata pet_type, quindi stabilisci se la richiesta viene accettata oppure perché la validazione la rifiuta. Nell’issue non sono indicati file di progetto o test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi, I'm having issues getting an example spec using allOf to work. This is the spec, as provided by the OpenAPI docs:
openapi: 3.0.0
info:
title: AllOf.v1
version: '1.0'
servers:
- url: 'http://localhost:3000'
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
discriminator:
propertyName: pet_type
responses:
'200':
description: Updated
components:
schemas:
Pet:
type: object
required:
- pet_type
properties:
pet_type:
type: string
Dog: # "Dog" is a value for the pet_type property (the discriminator value)
allOf: # Combines the main `Pet` schema with `Dog`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Dog`
properties:
bark:
type: boolean
breed:
type: string
enum: [ Dingo, Husky, Retriever, Shepherd ]
Cat: # "Cat" is a value for the pet_type property (the discriminator value)
allOf: # Combines the main `Pet` schema with `Cat`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object
# all other properties specific to a `Cat`
properties:
hunts:
type: boolean
age:
type: integer
My test attempts to send a JSON PATCH request to the /pets endpoint, using:
[
'pet_type' => 'Cat',
'age' => 3,
'hunts' => true,
]
However, this only results in:
Request body did not match provided JSON schema.
Digging in a bit more, it appears that the validator doesn't see the pet_type property it should be inheriting from the Pet component.
Any experience with this, or ideas? Thanks in advance.
- Lingua principale
- PHP
- Stelle
- 500
- Fork
- 99
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cebe/php-openapi
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
cebe/php-openapi#250 ·
-
BC break in 1.8 Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
cebe/php-openapi#247 · 1 commento · 1 reazione ·
-
php 8.4 deprecations Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
cebe/php-openapi#245 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
cebe/php-openapi#242 · 6 commenti · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
cebe/php-openapi#238 ·
Tutte le issue di cebe/php-openapi
Issue simili
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug customer-reported
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Automattic/static-site-importer#1829 ·