Validating with named schemas
See original GitHub issueAfter the change from using a global schema map to passing around named schemas It seems to me that validating a message against a complex schema with nested named schemas is not possible (or I have just missed it).
Previously I would use fastavro.validation.validate
to validate the a message against a schema. However that fails without the global variable. However using the private API function fastavro.validation._validate
passing in the datum, schema and my named schemas works.
I don’t feel comfortable to simply use the private API, although it works at the moment. Would you consider introducing a function to the public API that wraps the private function, or add named_schemas
as a keyword only argument to fastavro.validation.validate
?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Schema Validation
If the Enterprise Gateway receives a message with an improperly formed <name> element, it will reject the message. The Schema Validation filter can...
Read more >Schema Validation on Confluent Server
Schema Validation enables the broker to verify that data produced to a Kafka topic is using a valid schema ID in Schema Registry...
Read more >How To Use Schema Validation in MongoDB
MongoDB has a feature called schema validation that allows you to apply constraints on your documents' structure. Schema validation is built ...
Read more >6. Schemas & Validation
Assigning types to a property enables certain validation keywords to be used for the property. For example, if a name property has a...
Read more >A Vocabulary for Structural Validation of JSON
JSON Schema (application/schema+json) has several purposes, one of which is JSON instance validation. This document specifies a vocabulary for JSON Schema ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I went ahead and merged this. It seems like it’s in a useable state and I’d rather go ahead and get it out there for people to use if they’d like to.
That’s a good observation, but I think that’s okay. The two ways around that that I can think of would be the following:
SCHEMA_DEFS
and was removed because it would cause non-obvious errorsnamed_schemas
structure (which is basically the local version ofSCHEMA_DEFS
) into some of these functions since that structure has the knowledge of previous parsed schemas. At the moment though I’m not a fan of users having to really interact with that structure as it feels like it would make for an ugly and unintuitive API.So for the moment I think being more explicit about the schema dependencies is okay.