Some utilities extend YAML syntax with custom tags. For example JJB introduces "include" tags, http://jenkins-job-builder.readthedocs.io/en/latest/definition.html?highlight=!include-raw#module-jenkins_jobs.local_yaml
YAML linter fails on provided examples.
Eg here
- job:
name: test-job-1
builders:
!include: include001.yaml.inc
it says unknown tag <!include:> at: '4,5'.
According to documentation, currently there is no way
But custom tags are language feature, see http://www.yaml.org/spec/1.2/spec.html#id2761292 , Example 2.24. Global Tags. This document causes errors too:
%TAG ! tag:clarkevans.com,2002:
--- !shape
# Use the ! handle for presenting
# tag:clarkevans.com,2002:circle
- !circle
center: &ORIGIN {x: 73, y: 129}
radius: 7
- !line
start: *ORIGIN
finish: { x: 89, y: 102 }
- !label
start: *ORIGIN
color: 0xFFEEBB
text: Pretty vector drawing.
Could you implement this spec or add some workaround?
Facing the same problem for CloudFormation templates which have tags like !Ref, !GetAtt etc.
Currently as far as I can tell the underlying parser doesn't support custom tags. I'm not sure if that is something that could be easily added to that parser or if its worth changing parsers.
Having the same issue db_url: !secret db_url when using secrets variables in home assistant.
@JPinkney right, it has only built-in support for !include tag. Project also seems to be a bit small and lonely.
Can't you use https://github.com/nodeca/js-yaml as underlying parser? It seems to support custom tags. I'm just asking, not an expert in js and don't really now how stuff works in this extension.
@sanyer I'm going to look into it and compare a few of the options
@JPinkney cool, thanks :-)
I realized that the same problem is with Ansible playbooks. It has custom !vault tag for inlining encrypted secrets.
BTW, there is a plugin for atom https://atom.io/packages/linter-js-yaml where this option is supported.
Does js-yaml provide an AST? Last time I have checked there was only one YAML parser that provided AST. Without an AST we can not provide code assist.
There is a new one that provides an AST that I've been looking into. I haven't done a full evaluation yet but it could potentially help resolve this and https://github.com/redhat-developer/vscode-yaml/issues/75
@JPinkney awesome, great that there are suitable alternatives
Is this still being considered? I work with YAML which includes custom tags as well and my files show tons of errors that aren't real.
It will be added in the release tomorrow.
Added in 0.0.12 release.
Most helpful comment
Having the same issue
db_url: !secret db_urlwhen using secrets variables in home assistant.