How to use the fastjsonschema.ref_resolver.RefResolver function in fastjsonschema

To help you get started, we’ve selected a few fastjsonschema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github horejsek / python-fastjsonschema / fastjsonschema / __init__.py View on Github external
def _factory(definition, handlers, formats={}):
    resolver = RefResolver.from_schema(definition, handlers=handlers)
    code_generator = _get_code_generator_class(definition)(definition, resolver=resolver, formats=formats)
    return resolver, code_generator
github horejsek / python-fastjsonschema / fastjsonschema / generator.py View on Github external
self._variables = set()
        self._indent = 0
        self._indent_last_line = None
        self._variable = None
        self._variable_name = None
        self._root_definition = definition
        self._definition = None

        # map schema URIs to validation function names for functions
        # that are not yet generated, but need to be generated
        self._needed_validation_functions = {}
        # validation function names that are already done
        self._validation_functions_done = set()

        if resolver is None:
            resolver = RefResolver.from_schema(definition)
        self._resolver = resolver

        # add main function to `self._needed_validation_functions`
        self._needed_validation_functions[self._resolver.get_uri()] = self._resolver.get_scope_name()

        self._json_keywords_to_function = OrderedDict()