Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#8,665 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php

Research direction

Start in SchemaPropertyMetadataFactory, where the issue identifies TypeIdentifier::MIXED as mapping to string; inspect nearby type handling and related schema tests. Check how the generated schema represents mixed, then update or add a focused test showing that numeric values such as 0 are accepted. Done when generated schemas allow any value for mixed properties.

Written by the indexing model from the issue text.

Description

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

Dominant language
PHP
Stars
2.6k
Forks
987
Avg merge
1d 10h
Merged PRs (30d)
76

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from api-platform/core

All issues in api-platform/core

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.