ajv-validator / ajv-validator/ajv-cli
Support YAML CustomTags
- Langage dominant
- TypeScript
- Étoiles
- 316
- Forks
- 77
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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"
]
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.