Ability to specify schema and data without a filenameSee original GitHub issue
Currently you use the library like this:
import yamale schema = yamale.make_schema('./schema.yaml') # Create a Data object data = yamale.make_data('./data.yaml') # Validate data against the schema. Throws a ValueError if data is invalid. yamale.validate(schema, data)
It would be really useful if there was an option to provide the schema and data as Python strings instead - that way the could be loaded from a database or from an incoming HTTP request.
Something like this could work
import yamale schema = yamale.make_schema(content=""" name: str() age: int(max=200) height: num() awesome: bool() """) data = yamale.make_data(content=""" name: Bill age: 26 height: 6.2 awesome: True """) yamale.validate(schema, data)
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
This enhancement is in version 2.2.0. Thanks!