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

feat(validator): parameter validation #6296

Merged
merged 1 commit into from Apr 29, 2024

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Apr 5, 2024

Adds constraint to parameters to allow validation:

  • add tests
  • add a Metadata factory that automatically adds constraints based on OpenAPI and metadata informations

@soyuka soyuka force-pushed the parameter-validator branch 7 times, most recently from 38c54d6 to 2f3e56f Compare April 29, 2024 09:18
src/Metadata/Parameter.php Outdated Show resolved Hide resolved
src/Metadata/Parameter.php Show resolved Hide resolved
/**
* @return Constraint|Constraint[]|null
*/
public function getConstraints(): array|Constraint|null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function getConstraints(): array|Constraint|null
public function getConstraints(): Constraint|array|null

Nit: for consistency with the type of the property.

src/Symfony/Validator/State/ParameterValidatorProvider.php Outdated Show resolved Hide resolved
src/Metadata/Parameter.php Show resolved Hide resolved
src/Metadata/Parameter.php Show resolved Hide resolved
Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM when docs fix will be merged.

@soyuka soyuka merged commit e867d07 into api-platform:main Apr 29, 2024
74 of 76 checks passed
@soyuka soyuka deleted the parameter-validator branch April 29, 2024 13:29
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

4 participants