martin-g commented on code in PR #401:
URL: https://github.com/apache/avro-rs/pull/401#discussion_r2692028318
##########
avro/src/schema.rs:
##########
@@ -1380,6 +1384,15 @@ impl Schema {
})
}
+ /// Returns a `Schema::Union` with the given variants.
+ ///
+ /// # Errors
+ /// Will return an error if `variants` has duplicate unnamed schemas or if
`variants`
+ /// contains a union.
+ pub fn union(variants: Vec<Schema>) -> AvroResult<Schema> {
Review Comment:
```suggestion
pub fn union(schemas: Vec<Schema>) -> AvroResult<Schema> {
```
##########
avro/src/schema.rs:
##########
@@ -1380,6 +1384,15 @@ impl Schema {
})
}
+ /// Returns a `Schema::Union` with the given variants.
+ ///
+ /// # Errors
+ /// Will return an error if `variants` has duplicate unnamed schemas or if
`variants`
Review Comment:
```suggestion
/// Will return an error if `schemas` has duplicate unnamed schemas or
if `schemas`
```
##########
avro/src/schema.rs:
##########
@@ -1380,6 +1384,15 @@ impl Schema {
})
}
+ /// Returns a `Schema::Union` with the given variants.
+ ///
+ /// # Errors
+ /// Will return an error if `variants` has duplicate unnamed schemas or if
`variants`
+ /// contains a union.
+ pub fn union(variants: Vec<Schema>) -> AvroResult<Schema> {
+ UnionSchema::new(variants).map(Schema::Union)
Review Comment:
```suggestion
UnionSchema::new(schemas).map(Schema::Union)
```
##########
avro/src/schema.rs:
##########
@@ -979,6 +979,10 @@ pub struct UnionSchema {
impl UnionSchema {
/// Creates a new UnionSchema from a vector of schemas.
+ ///
+ /// # Errors
+ /// Will return an error if `variants` has duplicate unnamed schemas or if
`variants`
Review Comment:
```suggestion
/// Will return an error if `schemas` has duplicate unnamed schemas or
if `schemas`
```
--
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]