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)
| 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 | |
| 107 | impl SchemaNameValidator for SpecificationValidator {} |
no test coverage detected