Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

array<string, mixed> only allows string values in the generated schema

オープン 初心者向け
#8,665 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php

調査の方向性

SchemaPropertyMetadataFactoryから始めます。issueでは、TypeIdentifier::MIXEDがstringにマッピングされるとされています。近くにある型の処理と関連するスキーマテストを調べてください。生成されたスキーマでmixedがどのように表現されるかを確認し、数値0などが受け入れられることを示す対象を絞ったテストを更新するか追加します。生成されたスキーマがmixedプロパティに任意の値を許可すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

The problem

API Platform treats mixed as string when it generates the OpenAPI schema. A property that can hold any value ends up as "strings only".

Example

/** @var array<string, mixed> */
public array $metadata = [];

The data is {"chunk_number": 0}. The number 0 is valid for mixed.

The generated schema says:

"metadata": { "type": "object", "additionalProperties": { "type": ["string", "null"] } }

That only allows strings and null. A client that validates the data against the schema reports it as invalid.

What I expected

mixed means "any value", so the schema should allow any value.

Where it comes from

SchemaPropertyMetadataFactory contains TypeIdentifier::MIXED => ['type' => 'string']. It is also on main.

Version: api-platform/core 4.4.2

主要言語
PHP
スター
2.6k
フォーク
987
平均マージ
1日 8時間
マージ済み PR(30日)
80

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

api-platform/core のほかの issue

api-platform/core の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。