Skip to content

feat(metadata): add ScalarHeaderParameter - #8679

Merged
soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/scalar-header-parameter
Oct 16, 2026
Merged

soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/scalar-header-parameter

Conversation

@soyuka

@soyuka soyuka commented Oct 13, 2026

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets Closes #8499
License MIT
Doc PR api-platform/docs#2322 (to update with the new class)

A HeaderParameter without schema type defaults to string|list<string>, so constraints get the raw header list (['']) and NotBlank passes on an empty header. ScalarHeaderParameter defaults its native type to string instead, a schema type still wins.

'Foo' => new ScalarHeaderParameter(required: true, constraints: [new NotBlank()]),

Test: tests/Functional/Parameters/ParameterTest.php::testScalarHeaderParameterNotBlank

A HeaderParameter defaults to string|list<string>, so constraints
receive the raw header list and NotBlank passes on an empty header.
ScalarHeaderParameter defaults to string instead.

Closes api-platform#8499
@soyuka
soyuka merged commit 70abf93 into api-platform:main Oct 16, 2026
114 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HeaderParameter constraint-validators receive array value by default

1 participant