fix(loader): update parse boolean to work with all accepted yaml values #633
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhanced YAML Boolean Parsing for CloudFormation Guard
Summary
This PR enhances the YAML loader to properly handle all standard YAML boolean values. The implementation now correctly recognizes the full range of YAML 1.1 boolean representations
including:
• true, yes, on, y (and their case variations) as boolean true
• false, no, off, n (and their case variations) as boolean false
Problem
Previously, the loader was using Rust's standard parse::() which only recognizes "true" and "false" strings. This limited functionality prevented CloudFormation Guard from correctly
parsing YAML files that use alternative boolean representations that are valid in the YAML specification.
Solution
The implementation now includes:
• A custom boolean parser that handles all YAML 1.1 boolean representations
Testing
Added extensive unit tests that verify:
• All valid YAML boolean representations are correctly parsed
• Case insensitivity is properly handled
• The parser correctly distinguishes between boolean values and other types