jklamer commented on a change in pull request #1620:
URL: https://github.com/apache/avro/pull/1620#discussion_r834787814
##########
File path: lang/rust/avro/src/types.rs
##########
@@ -333,8 +333,15 @@ impl Value {
/// See the [Avro
specification](https://avro.apache.org/docs/current/spec.html)
/// for the full set of rules of schema validation.
pub fn validate(&self, schema: &Schema) -> bool {
+ let rs = ResolvedSchema::try_from(schema).expect("Schema didn't
successfully parse");
+ self.validate_internal(schema, rs.get_names())
+ }
+
+ fn validate_internal(&self, schema: &Schema, names: &NamesRef) -> bool {
Review comment:
Also what would you think about having this return a result? We should
be able to reuse the resolved schema in the encode flow as well and propagate
schema resolution errors up?
##########
File path: lang/rust/avro/src/types.rs
##########
@@ -333,8 +333,15 @@ impl Value {
/// See the [Avro
specification](https://avro.apache.org/docs/current/spec.html)
/// for the full set of rules of schema validation.
pub fn validate(&self, schema: &Schema) -> bool {
+ let rs = ResolvedSchema::try_from(schema).expect("Schema didn't
successfully parse");
+ self.validate_internal(schema, rs.get_names())
+ }
+
+ fn validate_internal(&self, schema: &Schema, names: &NamesRef) -> bool {
Review comment:
I believe we will need the enclosing namespace passed through here as
well to help with any Name Refs that don't include full namespaces. Will check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]