-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(yaml-cfn): do not deserialize year-month-date as strings #13745
Conversation
@@ -54,6 +54,6 @@ const shortForms: yaml_types.Schema.CustomTag[] = [ | |||
function parseYamlStrWithCfnTags(text: string): any { | |||
return yaml.parse(text, { | |||
customTags: shortForms, | |||
schema: 'yaml-1.1', | |||
schema: 'core', |
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.
But are we sure using the core
schema is not going to break other stuff? I.e: is "No"
going to be encoded correctly (read: quoted), or is it going to be encoded YAML-1.2-style (which in Yaml 1.1 is an alias for false
?
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.
Good point! I added a test confirming that No
is deserialized correctly (as "No"
, not false
).
Let me know if you want to see some more tests of some edge-cases in the YAML handling!
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709
0cdb139
to
40f8067
Compare
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we are using the
yaml-1.1
schema when de-serializing YAML documents,Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09'
as Date objects, instead of just simple strings.
This has been noted by a customer using the cloudformation-include module,
but I assume a very similar problem exists for other places we parse YAML,
like cloudformation-diff.
Switch to the
core
schema fromyaml-1.1
,where those are treated as strings, instead of dates.
Fixes #13709
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license