Skip to content

Commit cd20f57

Browse files
committed
Minor cleanup
1 parent 704a7ab commit cd20f57

File tree

1 file changed

+3
-3
lines changed
  • src/confluent_kafka/schema_registry/common

1 file changed

+3
-3
lines changed

src/confluent_kafka/schema_registry/common/avro.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ def _disjoint(tags1: Set[str], tags2: Set[str]) -> bool:
225225

226226
def _resolve_union(schema: AvroSchema, message: AvroMessage) -> Tuple[Optional[AvroSchema], AvroMessage]:
227227
is_wrapped_union = isinstance(message, tuple) and len(message) == 2
228-
is_typed_union = '-type' in message
228+
is_typed_union = isinstance(message, dict) and '-type' in message
229229
for subschema in schema:
230230
try:
231231
if is_wrapped_union:
232-
if message[0] == subschema["name"]:
232+
if isinstance(subschema, dict) and subschema["name"] == message[0]:
233233
return (subschema, message[1])
234234
elif is_typed_union:
235-
if message['-type'] == subschema["name"]:
235+
if isinstance(subschema, dict) and subschema["name"] == message['-type']:
236236
return (subschema, message)
237237
else:
238238
validate(message, subschema)

0 commit comments

Comments
 (0)