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

Method parse

avro/src/schema/parser.rs:105–116  ·  view source on GitHub ↗

Create a `Schema` from a `serde_json::Value` representing a JSON Avro schema.

(
        &mut self,
        value: &Value,
        enclosing_namespace: NamespaceRef,
    )

Source from the content-addressed store, hash-verified

103 /// Create a `Schema` from a `serde_json::Value` representing a JSON Avro schema.
104 pub(super) fn parse(
105 &mut self,
106 value: Value,
107 enclosing_namespace: NamespaceRef,
108 ) -> AvroResult<Schema> {
109 match value {
110 Value::String(t) => self.parse_known_schema(t.as_str(), enclosing_namespace),
111 Value::Object(data) => self.parse_complex(data, enclosing_namespace),
112 Value::Array(data) => self.parse_union(data, enclosing_namespace),
113 _ => Err(Details::ParseSchemaFromValidJson.into()),
114 }
115 }
116
117 /// Parse a string as a primitive type or reference to `parsed_schemas`.
118 fn parse_known_schema(
119 &mut self,

Callers 7

parse_strMethod · 0.45
parse_input_schemasMethod · 0.45
fetch_schema_refMethod · 0.45
parse_arrayMethod · 0.45
parse_mapMethod · 0.45
parse_unionMethod · 0.45

Calls 3

parse_known_schemaMethod · 0.80
parse_complexMethod · 0.80
parse_unionMethod · 0.80

Tested by

no test coverage detected