在类似于 Json 模式的 python 中验证 yaml

Validating yaml in python similar to Json schema

我需要验证几个 YAML 文件,我找不到类似的东西 Json - 模式,用于验证 Json 结构 YAML

有这样的东西吗

YAML 没有 JSON 架构之类的东西,因为不需要。 YAML 和 JSON 使用相同的数据模型,这意味着您可以像解析 JSON 并将其传递给 [=14] 一样解析 YAML 并将其传递给 JSON 模式验证器=] 模式验证器。

换句话说,JSON 架构验证 YAML 以及 JSON。