Closed ImmanuelHaffner closed 4 years ago
Hi, thanks for your interest in Yamale.
Here's the full data file we want to validate:
list_with_two_types:
- 'some'
- rsid: 'rs123'
name: 'some SNP'
- 'thing'
- rsid: 'rs312'
name: 'another SNP'
questions:
- choices:
- id: 'id_str'
- id: 'id_str1'
questions:
- choices:
- id: 'id_str'
- id: 'id_str1'
Let's take a look at the referenced schema in parts. At the top, we have:
list_with_two_types: list(str(), include('variant'))
questions: list(include('question'))
The list_with_two_types
and questions
match the two top level attributes in the data. Great! We see that the attribute questions
is a list of question
type. I think that's where the confusion is. The questions
attribute has a type of question
.
Just to continue, we look later in the schema for that type:
question:
choices: list(include('choices'))
questions: list(include('question'), required=False)
Here we see that each element in the list is a map made up of choices
and questions
. Looking at the data, that's exactly what we have.
Let me know if you have any other questions.
Oh cool, thanks for the fast response. Makes perfectly sense now.
And great tool, keep up the good work 😁
In the README example on lists, the schema has
and the example data has
I'm not very familiar with YAML syntax, but i think there is a typo (singular vs plural). Either
question:
in the schema should bequestions:
or the outerquestions:
in the data should bequestion:
.