Open DevOpsJeremy opened 3 days ago
Although a custom constructor is a more general solution -- and I like the generality in principle -- if yq
is working for you as a preprocessor, then that means that you don't need to evaluate these tags in order for the content to validate. Stripping them out or ignoring them is enough.
If there's an option to ignore unknown tags in ruamel.yaml
, then that's something which would probably fit well with the existing CLI structure for baked-in transforms for Azure and GitLab.
If you really need customizations for the YAML parsing, I think the interface needs some serious thought. One solution I like would be to allow users to pass their own parser. Then you can do whatever you want with no limitations, but check-jsonschema
's interface stays really simple to understand.
I only want to pursue more complex solutions if there's sufficient demand. I think we can meet your needs with "ignore unknown tags" as an option, so I'll look into that first.
This issue requested support specifically for the
!reference
tag in a Gitlab CI file, however, there doesn't appear to be support for other tags. Specifically in my case, Ansible-specific tags like!unsafe
or!vault
.Example content:
Output:
The workaround in my case is to convert the content to JSON with
yq
then validate--which isn't ideal.Is it possible to add support for custom tags like these? Possibly by allowing the user to pass in a custom constructor for their respective tags that can be passed through to the
ruamel.yaml
parser.