Create a `Schema` from a `serde_json::Value` representing a JSON Avro schema.
(
&mut self,
value: &Value,
enclosing_namespace: NamespaceRef,
)
| 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, |
no test coverage detected