You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromjsonschemaimportvalidatefromzoo.schemaimportfps, combineinstance= {'_id': '1', 'seq': 'ACTG'}
fragments= ['core', 'derivative']
schema=combine(fps(fragments), additional=False, required=None)
validate(instance, template) # returns None, all's well# add a property, which is not one of the allowed propertiesinstance['foo'] ='bar'validate(instance, template) # throws ValidationError
def is_valid(instance, ):
'''Validate a hash map against a zoo JSON schemas.
zoo compose --fp /optional/path core,derivative(allow,recursion?) template.json
# if it does not find them at top directory will recursively enter subfolders, like node_modules
# --allow_additonal_fields --required _id,seq,foo,bar
zoo init --validate path/to/template.json
'''
...
I think the recursive definition is better than using JSON links/references, bc/ it is more explicit and because the latter are defined/ specified in such a variety of ways, that there seems to be not single best solution but a couple of hacky ones.
...
The text was updated successfully, but these errors were encountered: