Skip to content

Allow null on allowReserved and allowEmptyValue properties#7315

Merged
soyuka merged 1 commit into
api-platform:4.1from
snoob:swagger-deprecation
Jul 29, 2025
Merged

Allow null on allowReserved and allowEmptyValue properties#7315
soyuka merged 1 commit into
api-platform:4.1from
snoob:swagger-deprecation

Conversation

@snoob

@snoob snoob commented Jul 25, 2025

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.1
Tickets Closes #7220
License MIT
Doc PR N/A

As discussed here: #7220, the Swagger specification now restricts the use of allowReserved and allowEmptyValue (see https://swagger.io/specification).

allowReserved only applies to parameters with an in value of query
allowEmptyValue is valid only for query parameters
Using it on a path or header parameter is deprecated.

By default, ApiPlatform sets both properties to false regardless of the parameter type. The workaround is to set it to null instead so that it is not generated in the schema.

The purpose of this merge request is to allow null as a valid value for these two properties.

@snoob snoob force-pushed the swagger-deprecation branch from eb72685 to 1b7ab1d Compare July 25, 2025 20:21
@snoob snoob force-pushed the swagger-deprecation branch from 1b7ab1d to 4cf81de Compare July 25, 2025 20:24
@soyuka soyuka merged commit 4f717c1 into api-platform:4.1 Jul 29, 2025
113 checks passed
@soyuka

soyuka commented Jul 29, 2025

Copy link
Copy Markdown
Member

Thanks! It'd be nice to fix the constructor on the main branch and use null as default value. At least we should set null according to the parameter type.

@snoob

snoob commented Jul 29, 2025

Copy link
Copy Markdown
Contributor Author

@soyuka i wanted to create a MR but it's already null on main branch.

I compared the properties and getter/canner with the main branch and i realized that i probably forgot to update the return type for this methods on 4.1.. Sorry for that

#7322

@VincentLanglet

Copy link
Copy Markdown
Contributor

Hi @snoob, while closing the PR #7220 ; does this PR close also the original issue #7212 then ?

@snoob

snoob commented Jan 16, 2026

Copy link
Copy Markdown
Contributor Author

Hi @snoob, while closing the PR #7220 ; does this PR close also the original issue #7212 then ?

i don't know. Maybe the original PR did more work like specify the value according to the parameter type ? when i only extended the type-hint by allowing null...

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.

3 participants