YAML 架构验证? [英] YAML Schema Validation?

查看:75
本文介绍了YAML 架构验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YAML 是否有模式验证语言?我用谷歌搜索但找不到任何有用的东西.

Is there a schema validation language for YAML? I've googled but couldn't find anything useful.

像 XSD 格式那样,使用语言本身来描述架构,将是我的最佳选择.

Something like XSD format, using the language itself to describe the schema, would be the best choice in my case.

推荐答案

JSON Schema 可用于大多数YAML 文档比 RxKwalify.JSON Schema 是我能够找到的三个中唯一的编辑器支持.

JSON Schema can be used with most YAML documents resulting in a more portable and better documented solution than Rx or Kwalify. JSON Schema is the only of the three for which I have been able to find editor support.

更多有关使用 YAML 和 JSON Schema 的信息,包括工具和编辑器支持在此页面上进行了跟踪.在撰写本文时,Visual Studio Code 提供编辑器支持,并通过 npm 提供基于命令行的验证工具.

More information on using YAML and JSON Schema including tools and editor support is tracked on this page. At the time of writing, there is editor support in Visual Studio Code and a command-line based validation tool available via npm.

完全披露:我创建了上面链接的网站,以尝试使 JSON Schema 对 YAML 的应用更容易被发现.我还为 VS Code 编写了一个编辑器扩展,后来被上面链接的 RedHat 扩展所取代.

Full Disclosure: I authored the web site linked above to try to make the application of JSON Schema to YAML more discoverable. I also wrote an editor extension for VS Code that has since been superseded by the RedHat extension linked above.

这篇关于YAML 架构验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆