MCPcopy Create free account
hub / github.com/apache/avro-rs / validate

Method validate

avro/src/validator.rs:95–104  ·  view source on GitHub ↗

Validates the schema name and returns the start byte of the name. Requires that the implementation of [`Self::regex`] provides a capture group named `name` that captures the name part of the full name. Should return [`Details::InvalidSchemaName`] if it is invalid.

(&self, schema_name: &str)

Source from the content-addressed store, hash-verified

93 ///
94 /// Should return [`Details::InvalidSchemaName`] if it is invalid.
95 fn validate(&self, schema_name: &str) -> AvroResult<usize> {
96 let regex = SchemaNameValidator::regex(self);
97 let caps = regex
98 .captures(schema_name)
99 .ok_or_else(|| Details::InvalidSchemaName(schema_name.to_string(), regex.as_str()))?;
100 Ok(caps
101 .name("name")
102 .ok_or(Details::InvalidSchemaNameValidatorImplementation)?
103 .start())
104 }
105}
106
107impl SchemaNameValidator for SpecificationValidator {}

Callers 4

validate_schema_nameFunction · 0.45
validate_namespaceFunction · 0.45

Implementers 2

validator.rsavro/src/validator.rs
validators.rsavro/tests/validators.rs

Calls 1

nameMethod · 0.45

Tested by

no test coverage detected