-
Notifications
You must be signed in to change notification settings - Fork 421
EventBridge Schema Registry uses custom formats not handled by new Validation code #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @n2N8Z - Thank you for raising this, and for creating a PR on that. We're all currently in PTO - We'll look into it in early January. In the meantime, wouldn't Parser utility be a better fit in this case? I wasn't aware you could have custom formats in JSON Schemas, and if |
I'm trying to validate an event against its schema definition, which is what fastjsonschema does, and so since that is the library you're using for the Validation feature, and because the feature is called "Validation", I figured that was the appropriate feature. If you think that the Parser feature is the feature to be used for event validation, then when would the Validation feature be used ?
It's not so much that fastjsonschema supports ignoring the custom formats, fjs defaults to validating formats, including custom formats, and so you need to provide a regex or function to do that. There's a specific issue (horejsek/python-fastjsonschema#108) with the EventBridge schema that I was working on, that results in the custom format validation being skipped even after a validation function is provided, but it must still be provided for the schema to be accepted. |
I've just merged that PR with some modifications and I'll circle back here once 1.10 is released with it - Hopefully by end of Friday if we manage to ship other minor improvements. As for your question - validation vs parser utility - it wouldn't indeed work now that I got my laptop and read through all issues, since this is a schema you don't have control over (EventBridge CloudTrail AWS API Call). Parser uses Pydantic so it can do both parsing as well as deep data validation, and it supports more complex use cases. Once again, we appreciate your contribution very much and we'll ping here once it's released in PyPi. Thank you <3 |
hey @n2N8Z - This is now available on 1.10 on PyPi and on SAR :) Closing this now, and thank you for the contribution, much appreciated! |
What were you trying to accomplish?
Validate events against EventBridge Schema Registry published schema.
Expected Behavior
AWS published schema can be imported, and events successfully validated against it.
Current Behavior
Importing schema results in fastjsonschema error:
fastjsonschema.exceptions.JsonSchemaDefinitionException: Unknown format: int64
Possible Solution
Pass through custom formats Dict.
AWS schema not use custom formats on non-string types.
fastjsonschema not fail on custom formats.
Custom formats for non-string types horejsek/python-fastjsonschema#108
Steps to Reproduce (for bugs)
[email protected]
Environment
The text was updated successfully, but these errors were encountered: