OpenAPI missing request schema when providing MediaType examples
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- PHP
- スター
- 2.6k
- フォーク
- 989
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 87
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
api-platform/core のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
api-platform/core#8680 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
api-platform/core#8664 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Metadata] Incorrect api schema for path variable対応中かも @bram123 が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
api-platform/core#8646 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
DenormalizationViolationFactory crash when GroupSequence is used対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
api-platform/core#8639 ·
メンテナーはふだん 1 日以内に返信
-
HTTP cache purgers error handling and performance issues対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
api-platform/core#8591 ·
メンテナーはふだん 1 日以内に返信
api-platform/core の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
matomo-org/device-detector#8405 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 4 日以内に返信