allOf validation not working?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Reproduce la solicitud JSON PATCH contra /pets utilizando el documento OpenAPI proporcionado y la referencia allOf del esquema Cat a Pet. Sigue cómo el validador resuelve Pet y su propiedad heredada pet_type, y determina después si la solicitud se acepta o por qué la validación la rechaza. En el issue no se mencionan archivos de proyecto ni pruebas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- PHP
- Estrellas
- 500
- Forks
- 99
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cebe/php-openapi
-
Deprecated warnings in PHP 8.2 Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
cebe/php-openapi#250 ·
-
BC break in 1.8 Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
cebe/php-openapi#247 · 1 comentario · 1 reacción ·
-
php 8.4 deprecations Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
cebe/php-openapi#245 · 3 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
cebe/php-openapi#242 · 6 comentarios · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
cebe/php-openapi#238 ·
Todos los issues de cebe/php-openapi
Issues similares
-
tooling
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
UX
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
bug customer-reported
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Automattic/static-site-importer#1829 ·