Skip to content

Commit

Permalink
ASN.1 SET
Browse files Browse the repository at this point in the history
Signed-off-by: Clemens Vasters <clemens@vasters.com>
  • Loading branch information
clemensv committed Mar 5, 2024
1 parent a96dda7 commit 9185386
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avrotize/asn1toavro.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List
import asn1tools
from asn1tools.codecs.ber import Sequence, SequenceOf, Integer, Boolean, Enumerated, OctetString, IA5String, UTF8String, Date, Real, Choice, Null, SetOf, Recursive, ExplicitTag
from asn1tools.codecs.ber import BitString, VisibleString, BMPString, GeneralString, GraphicString, NumericString, PrintableString, TeletexString, UniversalString, ObjectIdentifier
from asn1tools.codecs.ber import BitString, VisibleString, BMPString, GeneralString, GraphicString, NumericString, PrintableString, TeletexString, UniversalString, ObjectIdentifier, Set

from avrotize.common import avro_name
from avrotize.dependency_resolver import sort_messages_by_dependencies
Expand All @@ -24,12 +24,12 @@ def asn1_type_to_avro_type(asn1_type: dict, avro_schema: list, namespace: str, p
'namespace': namespace,
'symbols': symbols
}
elif isinstance(asn1_type, Sequence) or isinstance(asn1_type, Choice):
elif isinstance(asn1_type, Sequence) or isinstance(asn1_type, Choice) or isinstance(asn1_type, Set):
if avro_schema and next((s for s in avro_schema if s.get('name') == asn1_type.type_name), []):
return namespace + '.' + asn1_type.type_name
else:
record_name = asn1_type.type_name if asn1_type.type_name else asn1_type.name
if record_name == 'CHOICE' or record_name == 'SEQUENCE':
if record_name == 'CHOICE' or record_name == 'SEQUENCE' or record_name == 'SET':
if parent_member_name and parent_type_name:
record_name = parent_type_name + parent_member_name
elif parent_type_name:
Expand Down

0 comments on commit 9185386

Please sign in to comment.