Closed daljeet-singh closed 2 years ago
Hi, thanks for your interest in Yamale.
The add_include
API will add another document to the schema. For example, let's say I had this schema:
person: include('human')
---
human:
name: str()
age: int()
friend: include('human', required=False)
I could write that inline in Python like this:
schema = yamale.make_schema(content="""
person: include('human')
""")
schema.add_include(
{
"human": {
"name": "str()",
"age": "int()",
"friend": "include('human', required=False)",
}
}
)
As of today, there isn't a way to dynamically add to the schema once the schema object is created. You would need to parse the yaml yourself, add any additions you need, and then call make_schema
on the new content.
I hope that makes it a little more clear. Please let us know if you have any other questions.
Thanks, I guess we can close this issue :-)
Maybe I am not using it correctly, New to yamale. I am trying to add extra validation to the schema, but it doesn't seem to be working.
It doesn't seem to add this to schema validation.
My use case is, to add additional rules to the schema on the fly before validation.