Skip to content

Allow null on allowReserved and allowEmptyValue properties #7315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025

Conversation

snoob
Copy link

@snoob snoob commented Jul 25, 2025

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
Copy link
Member

soyuka commented Jul 29, 2025

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
Copy link
Author

snoob commented Jul 29, 2025

@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

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.

2 participants