Skip to content

[Hydra] Use validation groups for Hydra documentation - #3947

Closed
alanpoulain wants to merge 1 commit into
api-platform:mainfrom
alanpoulain:fix/hydra-validation-groups
Closed

[Hydra] Use validation groups for Hydra documentation#3947
alanpoulain wants to merge 1 commit into
api-platform:mainfrom
alanpoulain:fix/hydra-validation-groups

Conversation

@alanpoulain

Copy link
Copy Markdown
Member
QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRN/A

Same PR as #3806, but for Hydra.

The hydra:required property was always set to false if validation groups were used for the property in the NotBlank constraint.
It's because the property metadata are filled with the ValidatorPropertyMetadataFactory:

if (null === $required && isset($options['validation_groups'])) {
$required = $this->isRequiredByGroups($validatorPropertyMetadata, $options);
}

In Hydra, since the properties are decoupled from the operations, the code assumes that the "required" information is taken in the POST operation of the resource.

The "hydra:required" property was always set to false if validation
groups were used for the property.
@alanpoulain

Copy link
Copy Markdown
MemberAuthor

PHP 8 failure is not related.

Base automatically changed from master to mainJanuary 23, 2021 21:59
@alanpoulain

Copy link
Copy Markdown
MemberAuthor

WDYT @api-platform/core-team? For the part:

In Hydra, since the properties are decoupled from the operations, the code assumes that the "required" information is taken in the POST operation of the resource.

@stale

staleBot commented Nov 4, 2022

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stalestaleBot added the wontfix label Nov 4, 2022
@stale

staleBot commented Jan 3, 2023

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stalestaleBot added the stale label Jan 3, 2023
@stalestaleBot closed this Jan 10, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@alanpoulain