ajv-validator / ajv-validator/ajv-cli
Support YAML CustomTags
- 主要言語
- TypeScript
- スター
- 316
- フォーク
- 77
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Thank you very much for all your work
It would be nice to have an option to support custom tags in yaml. Tags in yaml can have one of 3 kinds: scalar, sequence, or mapping. I would like to have an option to add a list of custom tags and the kind of the type.
https://yaml.org/spec/1.2/spec.html#kind//
I found in the underlaying js-yang lib an example:
https://github.com/nodeca/js-yaml/blob/master/examples/custom_types.yml
```
subject: Custom types in JS-YAML
spaces:
- !space
height: 1000
width: 1000
points:
- !point [ 10, 43, 23 ]
- !point [ 165, 0, 50 ]
- !point [ 100, 100, 100 ]
```
https://github.com/nodeca/js-yaml/blob/master/examples/custom_types.js
I think for the validation we only would need the definition of the kind and add it as a schema. I was hoping something like this would do it.
```
new jsyaml.Type('!Space', { kind: 'mapping' });
````
I use manly VS Code with the YAML extension (yaml-language-server) and maybe it is possible to use the same format.
https://github.com/redhat-developer/yaml-language-server#adding-custom-tags
```
"yaml.customTags": [
"!Scalar-example scalar",
"!Seq-example sequence",
"!Mapping-example mapping"
]
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。