dataclasses-jsonschema icon indicating copy to clipboard operation
dataclasses-jsonschema copied to clipboard

UUID field validation fails when using latest fastjsonschema release

Open s-knibbs opened this issue 4 years ago • 1 comments

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.

s-knibbs avatar Oct 09 '19 13:10 s-knibbs

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?

Garito avatar Oct 09 '19 16:10 Garito