zyga / json-schema-validator

Implementation of json-schema.org
GNU Lesser General Public License v3.0
60 stars 18 forks source link

Seemingly no way to utilise the Validator class' stack mechanism #20

Open ScottA38 opened 4 years ago

ScottA38 commented 4 years ago

Obviously due to the lack of private members in Python I could hack my way around this but there doesn't seem to be an intended public method to push schemas and json data onto the Validator class stack.

Unless I have missed something it would be nice to be able to manually push many to stack and validate the each element in batch. Perhaps Validator.validate_toplevel() should just just validate the end of the current schema & object stack then pop those items off

Current keys: JSON_TYPE_MAP __class__ __delattr__ __dict__ __dir__ __doc__ __eq__ __format__ __ge__ __getattribute__ __gt__ __hash__ __init__ __init_subclass__ __le__ __lt__ __module__ __ne__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __sizeof__ __str__ __subclasshook__ __weakref__ _get_object_expression _get_schema_expression _object _pop_object _pop_schema _push_additional_property_schema _push_array_item_object _push_array_schema _push_object _push_property_object _push_property_schema _push_schema _report_error _report_unsupported _schema _validate _validate_additional_properties _validate_enum _validate_format _validate_items _validate_length _validate_pattern _validate_properties _validate_range _validate_requires _validate_type validate validate_toplevel Happy to have a go at this and make a pull request

zyga commented 4 years ago

I honestly don't remember how this code used to work. I will need to look before giving an answer.