martin-g commented on code in PR #470:
URL: https://github.com/apache/avro-rs/pull/470#discussion_r2826776022


##########
avro/src/schema/mod.rs:
##########
@@ -398,11 +398,13 @@ impl Schema {
     /// Returns the [Parsing Canonical Form] of `self` that is self contained 
(not dependent on
     /// any definitions in `schemata`)
     ///
+    /// If your require a self contained schema including `default` and `doc` 
attributes, see [`denormalize`][Schema::denormalize].

Review Comment:
   ```suggestion
       /// If you require a self contained schema including `default` and `doc` 
attributes, see [`denormalize`][Schema::denormalize].
   ```



##########
avro/src/schema/mod.rs:
##########
@@ -688,7 +690,18 @@ impl Schema {
         UnionSchema::new(schemas).map(Schema::Union)
     }
 
-    fn denormalize(
+    /// Remove all external references from the schema.
+    ///
+    /// `schemata` must contain all externally referenced schemas.
+    ///
+    /// # Errors
+    /// Will return a [`Details::SchemaResolutionError`] if it fails to find
+    /// a referenced schema. This will put the schema in a partly denormalized 
state.
+    pub fn denormalize(&mut self, schemata: &[Schema]) -> AvroResult<()> {
+        self.denormalize_inner(schemata, &mut HashSet::new())

Review Comment:
   ```suggestion
           let mut candidate = self.clone();
           candidate.denormalize_inner(schemata, &mut HashSet::new())?;
           *self = candidate;
           Ok(())
   ```
   to prevent `This will put the schema in a partly denormalized state.`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to