Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Normalize constraint violation parameters#29130

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromogizanagi:constraint_violation_normalizer_parameters
Mar 17, 2019
Merged

[Serializer] Normalize constraint violation parameters#29130

fabpot merged 1 commit intosymfony:masterfromogizanagi:constraint_violation_normalizer_parameters
Mar 17, 2019

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedNov 7, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRN/A?

Adding violation constraints' parameters to the normalized data, as these are valuable for an API client.

I usedparameters for now, as it's the name used inConstraintViolationInterface::getParameters(), but what aboutplaceholders orcontext?

@nicolas-grekasnicolas-grekas added this to thenext milestoneNov 8, 2018
@ogizanagi
Copy link
ContributorAuthor

Note: adding this by default might break CI testing API endpoint responses, but I don't see much more reasons not to do so. So, better keep adding by default, or add a context option for this?

@xabbuh
Copy link
Member

it may be better to make this behaviour opt-in

@dunglas
Copy link
Member

We don't guarantee that the output of the normalizers will never change. Especially, we don't guarantee that will not add fields. I'm in favor of adding it by default, but only if at least one parameter exists.

$violationEntry =array(
'propertyPath' =>$propertyPath,
'title' =>$violation->getMessage(),
'parameters' =>$violation->getParameters(),
Copy link
Member

@dunglasdunglasNov 8, 2018
edited
Loading

Choose a reason for hiding this comment

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

We should only add this key if at least one parameter exists:

if ($parameters =$violation->getParameters()) {$violationEntry['parameters'] =$parameters;}

Copy link
ContributorAuthor

@ogizanagiogizanagiNov 9, 2018
edited
Loading

Choose a reason for hiding this comment

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

May I ask what is the motivation behind this?
From my experience, this would just introduce additional complexity/confusion on the client side in the way would be consumed the data structure, only to save a few bytes.

Copy link
Member

@dunglasdunglas left a comment

Choose a reason for hiding this comment

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

Let's merge it as is. Can you rebase please?

@ogizanagi
Copy link
ContributorAuthor

Now rebased :)

@lyrixx
Copy link
Member

this one is OK too. let's merge it. /cc@dunglas (easy pick)

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot merged commit32c90eb intosymfony:masterMar 17, 2019
fabpot added a commit that referenced this pull requestMar 17, 2019
… (ogizanagi)This PR was merged into the 4.3-dev branch.Discussion----------[Serializer] Normalize constraint violation parameters| Q             | A| ------------- | ---| Branch?       | master <!-- see below -->| Bug fix?      | no| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | yes <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | N/A?Adding violation constraints' parameters to the normalized data, as these are valuable for an API client.I used `parameters` for now, as it's the name used in `ConstraintViolationInterface::getParameters()`, but what about `placeholders` or `context`?Commits-------32c90eb [Serializer] Normalize constraint violation parameters
@ogizanagiogizanagi deleted the constraint_violation_normalizer_parameters branchMarch 17, 2019 21:19
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
fabpot added a commit that referenced this pull requestJun 4, 2019
…eters (ogizanagi)This PR was merged into the 4.4 branch.Discussion----------[Validator] Add compared value path to violation parameters| Q             | A| ------------- | ---| Branch?       | 4.4 <!-- see below -->| Bug fix?      | no| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | N/AWhile it's not really useful to use as a placeholder in the violation message template (compared to hard-coding it into the message. Nor it is really user-friendly),it becomes handy in conjunction with#29130 for any mapping logic on client-side.Commits-------2da226a [Validator] Add compared value path to violation parameters
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@dunglasdunglasdunglas approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@lyrixxlyrixxlyrixx approved these changes

+1 more reviewer

@juliendufresnejuliendufresnejuliendufresne approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

8 participants

@ogizanagi@xabbuh@dunglas@lyrixx@fabpot@nicolas-grekas@juliendufresne@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp