YAML 文件的接口/默认定义
我有一个配置文件,想要标准化密钥。 因此,当其他开发人员创建自己的配置时,它们将得到验证。
当使用编程语言时,你使用的是接口。
我还知道,某些基于 YAML 的工具(例如 Ansible)也有默认值/定义,以确保您正确编写内容。但据我所知,它们还可以与插件等一起使用...
那么有没有办法在 YAML 文件中实现这种效果?
我的意思是我可以以某种方式以编程方式验证它,但也许有更好的东西。
I have a configuration file and want to standardize the keys.
So when other developers create their own configurations, they will be validated.
When using programming languages you use interfaces.
I also know that somehow some YAML-based Tools like Ansible also have defaults/definitions to ensure you are writing your stuff correctly. But as far as I know, they also work with addons and such...
So is there are a way to achieve this kind of effect in YAML files?
I mean I could programmatically validate it somehow, but maybe there is something better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有两个选择:
Ansible(以及许多其他基于 YAML 的框架)实际上并不是一个很好的例子,因为它在 YAML 之上使用 Jinja,因此验证起来要复杂得多。
You have two options:
Ansible (and lots of other YAML-based frameworks) isn't really a good example because it uses Jinja on top of YAML and therefore is far more complex to validate.