Yaml 模式验证 powershell [英] Yaml schema Validation powershell

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

问题描述

我正在使用 powershell-yaml 来解析我的YAML 转换为 PowerShell 对象.

I'm working with powershell-yaml to parse my YAML into a PowerShell object.

目前,我在验证 YAML 架构时遇到问题.我已经将这个包 yaml-schema-validator 用于我的 javascript 项目和我找不到任何熟悉的函数\模块来帮助我用 Powershell 解决这个问题.

currently, I have a problem validating my YAML schema. I've used this package yaml-schema-validator for my javascript project and I couldn't find any familiar function\moudle to help me solve this problem with Powershell.

Powershell 中是否有适用于 YAML 的架构验证语言?

Is There a schema validation language for YAML in Powershell?

推荐答案

简单地说,不,我不相信有任何 Powershell 本机选项可以针对 YAML 架构进行文档验证.

Simply put, no, I don't believe there are any Powershell native options for doc validation against a YAML schema.

由于 YAML 是 JSON 的超集,因此可以(取决于要验证的 YAML)使用以 JSON 表示的架构并通过 w/Test-JSON.

Since YAML is a super-set of JSON, one could (depending on the YAML being validated), use a schema expressed in JSON and validated w/Test-JSON.

我知道有两个活动的 YAML 模块:(1) PSYaml 和 (2) powershell-yaml.第二个是你今天使用的.我认为他们中的任何一个都不会根据架构验证 YAML 文档.

There are two active YAML modules I'm aware of: (1) PSYaml and (2) powershell-yaml. The second being what you use today. I don't believe either of them validate YAML docs against a schema.

我相信以下有架构验证模块/项目:

I believe there are schema validation modules/projects in the following:

  • 红宝石
  • Python
  • PHP
  • JavaScript

您可以在YAML的架构验证中查看该列表.

You can see the list in Schema Validation for YAML.

您总是可以用另一种语言进行验证,然后将该调用封装在 Powershell 中.您只需要自己处理集成.

You could always do you validation in another language, and wrap that call in Powershell. You just have to handle the integration yourself.

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

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