MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_with_references

Method parse_with_references

src/avro/src/schema.rs:1499–1513  ·  view source on GitHub ↗

Parse an JSON Avro schema with referenced named types. This is used when parsing a schema that references types defined in other schemas (Confluent Schema Registry schema references). Referenced schemas should be provided in dependency order (dependencies first). # Arguments `primary` - The primary schema JSON value to parse `reference_schemas` - Schemas whose named types should be available du

(
        primary: &Value,
        reference_schemas: &[Schema],
    )

Source from the content-addressed store, hash-verified

1497 /// * `primary` - The primary schema JSON value to parse
1498 /// * `reference_schemas` - Schemas whose named types should be available during parsing
1499 pub fn parse_with_references(
1500 primary: &Value,
1501 reference_schemas: &[Schema],
1502 ) -> Result<Self, AvroError> {
1503 // Collect and remap named types from all referenced schemas
1504 let (named, indices) = Self::collect_named_types(reference_schemas);
1505
1506 // Create parser with pre-populated named types
1507 let p = SchemaParser {
1508 named: named.into_iter().map(Some).collect(),
1509 indices,
1510 depth: 0,
1511 };
1512 p.parse(primary)
1513 }
1514
1515 /// Collect all named types from a list of schemas, remapping indices as needed.
1516 ///

Callers

nothing calls this directly

Calls 4

collectMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected