Closed dschiller closed 1 year ago
I copied all keys and used include()
, and now I can not find out how to ignore parent tags:
sjdneh7: include('library')
xbchd7: include('library')
z73ue8: include('library')
---
library:
data: str()
option: str()
tools:
any: str(required=false)
Yaml data to validate:
sjdneh7:
data: testdata
option: anyoption
xbchd7:
data: testdata
option: anyoption
tools:
any: abc
z73ue8:
data: testdata
option: anyoption
How can I make tools
not mandatory ?
sjdneh7.tools: Required field missing
I tried all validators but none is working. All fail with
yaml.scanner.ScannerError: mapping values are not allowed in this context
Found out how it works regarding the not mandatory tags:
sjdneh7: include('library')
xbchd7: include('library')
z73ue8: include('library')
---
library:
data: str()
option: str()
tools: include('library_tools', required=False)
---
library_tools:
any: str(required=false)
I think something like this will work for you:
map(include('library'))
---
library:
data: str()
option: str()
tools: map(required=False)
Thank you a lot Chris, that works perfect!
My yaml looks like
My scheme looks like
How can I describe the root entries ? As they are indistinguible and vari per entry I would like to know how I can describe them in the yaml schema.
When I change it to
And use
--no-strict
mode, it somehow works but fails withIs there a possibility to see the line number it fails at ?