dataclasses-jsonschema
dataclasses-jsonschema copied to clipboard
UUID field validation fails when using latest fastjsonschema release
It seems the latest release of fastjsonschema now raises an error when using custom string formats:
elif format_ == 'regex':
with self.l('try:'):
self.l('re.compile({variable})')
with self.l('except Exception:'):
self.exc('{name} must be a valid regex', rule='format')
else:
> raise JsonSchemaDefinitionException('Unknown format: {}'.format(format_))
E fastjsonschema.exceptions.JsonSchemaDefinitionException: Unknown format: uuid
For now, the dependency can be pinned. But it looks like custom formats have to be passed explicitly to the compile schema function.
My opinion on this: I guess that fastjsonschema is about performace cause it is not for convenience (it stops on the 1st error making useless to mark the errors in a form) Perhaps is time to open views to other libraries like https://github.com/p1c2u/openapi-spec-validator?