Skip to content

Commit

Permalink
validate checks for both UnionSchema and NamedUnionSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
tetron committed Jul 10, 2024
1 parent 9e849f5 commit fe0125e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schema_salad/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def friendly(v: Any) -> Any:
return f"array of <{friendly(v.items)}>"
if isinstance(v, avro.schema.PrimitiveSchema):
return v.type
if isinstance(v, avro.schema.UnionSchema):
if isinstance(v, (avro.schema.UnionSchema, avro.schema.NamedUnionSchema)):
return " or ".join([friendly(s) for s in v.schemas])
return avro_shortname(v)

Expand Down Expand Up @@ -235,7 +235,7 @@ def validate_ex(
f"expected list of {friendly(expected_schema.items)}"
)
return False
if isinstance(expected_schema, avro.schema.UnionSchema):
if isinstance(expected_schema, (avro.schema.UnionSchema, Namedavro.schema.UnionSchema)):
for s in expected_schema.schemas:
if validate_ex(
s,
Expand Down

0 comments on commit fe0125e

Please sign in to comment.