OpenAPI missing request schema when providing MediaType examples
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start by reproducing with the EntityResource class and the POST operation's custom openapi RequestBody from the issue, then inspect the generated OpenAPI output for that request body. The bug is that providing MediaType examples drops the schema, so the first question is where the custom MediaType replaces the generated one. Done when the request body keeps the resource schema alongside the examples, and the maintainers have settled whether the merge approach proposed in the issue is acceptable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
API Platform version(s) affected: 5.0.2
Description
Documenting requestBody examples removes the request format schemas
How to reproduce
Using the following ApiResource class:
#[Post(
status: 201,
openapi: new Operation(
requestBody: new RequestBody(
content: new ArrayObject(
[
'application/ld+json' => new MediaType(
examples: new ArrayObject(
[
'hello world' => new Example(description: 'Submitting a "hello world" entity', value: new EntityResource(1, 'Hello world')),
'foo bar' => new Example(description: 'Submitting a "foo bar" entity', value: new EntityResource(2, 'Foo bar')),
],
),
),
],
),
),
),
)]
readonly class EntityResource
{
public function __construct(#[ApiProperty(identifier: true)] public int $id, public string $name)
{
}
}
The schema is missing from the generated spec:
SwaggerUI output
And I have to add it myself, but this risks documentation drift caused by future API updates.
new ArrayObject(
[
'type' => 'object',
'properties' => new ArrayObject(
[
'id' => new ArrayObject(['type' => 'integer']),
'name' => new ArrayObject(['type' => 'string']),
],
),
],
),
SwaggerUI output
Additional
Would it be possible/okay to merge the API-Platform generated MediaType with the APIResource's MediaType? And only fill in the null values?
- Lingua principale
- PHP
- Stelle
- 2.6k
- Fork
- 987
- Merge medio
- 1g 7h
- PR unite (30g)
- 84
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 api-platform/core
-
Doctrine\Orm\OrderExtension fails on SortDirectionForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
api-platform/core#8660 ·
I maintainer di solito rispondono entro 1 giorno
-
DeserializeProvider calls PartialDenormalizationException::getErrors(), deprecated in Symfony 8.1Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
api-platform/core#8650 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
api-platform/core#8649 ·
I maintainer di solito rispondono entro 1 giorno
-
`OrderExtension` and `OrderFilter` pass string sort directions, deprecated since `doctrine/orm` 3.7Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
api-platform/core#8648 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
api-platform/core#8647 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di api-platform/core
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
components-web-app/api-components-bundle#403 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
mollie/PrestaShop#1566 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
components-web-app/docs#193 ·
-
Python 3.15 supportForse già presa @amnesiaof l’ha presa oggi. ApertaL: python L: python:uv
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dependabot/dependabot-core#16524 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
crazy-goat/rabbit-stream#830 ·
I maintainer di solito rispondono entro 1 giorno