-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] Fix XML example of ignoring an attribute #16824
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
[Serializer] Fix XML example of ignoring an attribute #16824
Conversation
ignore
element to attribute in Serializer XML exampleignore
element to attribute in XML example
ignore
element to attribute in XML example
Thanks for reporting this issue. We have a linter that checks the validity of code examples ... so this should have been detected. @OskarStark do you know why this wasn't reported by the linter? Thanks! |
If you mean DOCtor-RST it is only checking for valid XML structure, not the content. Not sure the code examples checker of @Nyholm provide such a feature 🤷 |
Code blocks checks is not active for xml. The main reason is that I had issues before and I haven’t come back to it. |
symfony/symfony#46594 has been merged, and should at least partially fix the root of the problem. |
I'm closing this as fixed because of what @HeahDude said. If I misunderstood and we still to merge this, please tell me and I'll reopen. Thanks! |
The linked code change was not related to the serializer configuration and thus does not affect this here, does it? |
Yeah the merged PR allows the checker to do its job, the fix was probably legit though. |
For reference https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/Serializer/Mapping/Loader/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd#L84. |
I rebased and force-pushed this morning, but GitHub is asking me to create a new PR. Maybe it will show up if this is reopened — but I also don’t mind running the code checker locally and addressing any other XML issues more comprehensively as new pull requests, if necessary. |
Ultimately, it looks like there are a number of changes required across the code-checker utility and sample application to actually make it detect this invalid configuration. First, the first line of the XML sample has to be a comment with the name of a config file that can be created in the sample app. Secondly, the file path must begin with This doesn’t make sense for the Serializer, because its XML config files go in I did create a file at that path in the sample app and even created an In light of this, I recreated this PR as #17327. |
…bute redux (likeuntomurphy) This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Fix XML example of ignoring an attribute redux This effectively reopens symfony#16824, which could not be reopened because of a rebase after the PR was closed. Commits ------- 3c0734a Change 'ignore' element to attribute in Serializer XML example
The XML example for configuring the Serializer to ignore an attribute is incorrect. It shows
ignore
as a child element ofattribute
instead of as an attribute ofattribute
.This causes the following exception: