3 ms·
Interesting. Is there documentation on how to programmatically validate Jason against a schema?
by factorialboy 6y ago
Interesting. Is there documentation on how to programmatically validate Jason against a schema?
- TimothyBJacobs 6y agoThe JSON Schema specification: https://json-schema.org https://json-schema.org
- bfuclusion 6y agoThere's some nice python packages to natively use it. https://pypi.org/project/jsonschema/ https://pypi.org/project/jsonschema/ We use it at Uclusion to make sure our front end is passing the right arguments, by having it be the first thing our lambdas do with the request body: from jsonschema import validate as validate_schema def validate_syntax(self, event): """ Subclasses are expected to override this to handle any syntactical validation different from here :param event: the request event object :return: """ schema = self.get_schema() # implemented by individual validator objects validate_schema(event, schema)