Skip to content
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

Fix wrong detection of OA min/max for symfony contraints with datetime strings #2148

Merged
merged 3 commits into from Jan 2, 2024

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented Nov 15, 2023

symfony range and comparison constraints can compare datetime strings, see https://github.com/symfony/validator/blob/0dbfc4b9b87a0e8245ff37d85cbe6b6ef677999f/Constraints/AbstractComparisonValidator.php#L68

If the constraints contain a comparison value that is not int (e.g. datetime string), we cannot infer a OpenAPI value for it. Previously it falsely casted those to int resulting in nonesense like minimum=0 and maximum=0 for string values.

…ings

If the constraints contain a comparison value that is not int (e.g. datetime string), we cannot infer a OpenAPI value for it. This falsely casted those to int resulting in nonesense like minimum=0 and maximum=0 for string values.
@DjordyKoert
Copy link
Collaborator

Looks good. could you also write a test for the situation where a string is passed to any of these attributes?

@DjordyKoert DjordyKoert merged commit bef8b65 into nelmio:master Jan 2, 2024
12 checks passed
@DjordyKoert
Copy link
Collaborator

Thanks @Tobion

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.

None yet

2 participants