-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add Yaml
constraint for validating YAML content
#53749
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
[Validator] Add Yaml
constraint for validating YAML content
#53749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved :)
Can you please rebase your changes onto the latest |
3b2514c
to
5cf1714
Compare
The following Psalm issue looks like false positive to me 🤔 :
This bit of code is a copy of the LintCommand::validate() method. |
src/Symfony/Component/Validator/Tests/Constraints/YamlValidatorTest.php
Outdated
Show resolved
Hide resolved
d549f65
to
594682c
Compare
594682c
to
912607b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the suggested change
17c1c8d
to
5b95cfd
Compare
2c88c44
to
e26da28
Compare
if (\E_USER_DEPRECATED === $level) { | ||
throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ro0NL Taken from the Yaml LintCommand.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase needed.
e26da28
to
bcbeb64
Compare
Yaml
constraint for validating YAML content
1e36e57
to
023d48c
Compare
Thank you @symfonyaml. |
Purpose
Inspired by the Json constraint, I've added a new feature to the Validator component for validating YAML content with a dedicated constraint.
Real world use case: Having configuration settings stored in YAML format within a database. With this new feature, you can validate the integrity of these configurations, ensuring the YAML syntax is OK.
Options
I've added a
flags
option to this constraint, aligning with the Yaml parser flags.Exemple