23andMe / Yamale

A schema and validator for YAML.
MIT License
670 stars 88 forks source link

Schema included in other schemas #186

Closed Chumachenko closed 2 years ago

Chumachenko commented 2 years ago

Hello. I have a question about Yamale validator. Mai i create a one general validation schema.yaml and use than in in another schemas? Should i use schema.add_include(dict) ?

Thanks in advance

Chumachenko commented 2 years ago

For example:

schema1.yml

schema2.yml

Mai i use schema.add_include(dict) in the schema2.yml included config1.yml file? I mean e.g:

schema2.yml

schema.add_include(path/schema1)

mildebrandt commented 2 years ago

Hi, thanks for using Yamale.

The add_include() API only takes a Python dict, so you'll first need to load the yaml and then pass the resulting dict into that method. However, that's only possible when validating using the Python API. Yamale doesn't provide a way to specify this from within a schema file.

Chumachenko commented 2 years ago

Thanks