structurize 2.22.1__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {structurize-2.22.1/structurize.egg-info → structurize-3.0.0}/PKG-INFO +1 -1
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/_version.py +3 -3
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotocsharp.py +19 -1
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotocsv.py +16 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/commands.json +213 -4
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/constants.py +5 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretocsharp.py +108 -28
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretots.py +2 -2
- {structurize-2.22.1 → structurize-3.0.0/structurize.egg-info}/PKG-INFO +1 -1
- {structurize-2.22.1 → structurize-3.0.0}/.gitignore +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/LICENSE +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/MANIFEST.in +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/README.md +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/__init__.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/__main__.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/asn1toavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotize.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotocpp.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotodatapackage.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotodb.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotogo.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotographql.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotoiceberg.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotojava.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotojs.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotojsons.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotojstruct.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotokusto.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotomd.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotools.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotoparquet.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotoproto.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotopython.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotorust.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotots.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/avrotoxsd.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/cddltostructure.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/common.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/csvtoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/datapackagetoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/dependencies/typescript/node22/package.json +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/dependency_resolver.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/dependency_version.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/jsonstoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/jsonstostructure.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/jstructtoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/kstructtoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/kustotoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/openapitostructure.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/parquettoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/proto2parser.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/proto3parser.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/prototoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretocddl.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretocpp.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretocsv.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretodatapackage.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretodb.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretogo.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretographql.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretoiceberg.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretojava.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretojs.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretojsons.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretokusto.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretomd.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretoproto.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretopython.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretorust.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/structuretoxsd.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/avrotize/xsdtoavro.py +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/build.ps1 +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/build.sh +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/pyproject.toml +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/setup.cfg +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/structurize.egg-info/SOURCES.txt +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/structurize.egg-info/dependency_links.txt +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/structurize.egg-info/entry_points.txt +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/structurize.egg-info/requires.txt +0 -0
- {structurize-2.22.1 → structurize-3.0.0}/structurize.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structurize
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Tools to convert from and to JSON Structure from various other schema languages.
|
|
5
5
|
Author-email: Clemens Vasters <clemensv@microsoft.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '
|
|
32
|
-
__version_tuple__ = version_tuple = (
|
|
31
|
+
__version__ = version = '3.0.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (3, 0, 0)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gb201f8a65'
|
|
@@ -16,6 +16,7 @@ from avrotize.constants import (
|
|
|
16
16
|
SYSTEM_MEMORY_DATA_VERSION,
|
|
17
17
|
PROTOBUF_NET_VERSION,
|
|
18
18
|
MSGPACK_VERSION,
|
|
19
|
+
CBOR_VERSION,
|
|
19
20
|
NUNIT_VERSION,
|
|
20
21
|
NUNIT_ADAPTER_VERSION,
|
|
21
22
|
MSTEST_SDK_VERSION,
|
|
@@ -53,6 +54,7 @@ class AvroToCSharp:
|
|
|
53
54
|
self.newtonsoft_json_annotation = False
|
|
54
55
|
self.system_xml_annotation = False
|
|
55
56
|
self.msgpack_annotation = False
|
|
57
|
+
self.cbor_annotation = False
|
|
56
58
|
self.avro_annotation = False
|
|
57
59
|
self.protobuf_net_annotation = False
|
|
58
60
|
self.generated_types: Dict[str,str] = {}
|
|
@@ -267,6 +269,7 @@ class AvroToCSharp:
|
|
|
267
269
|
newtonsoft_json_annotation=self.newtonsoft_json_annotation,
|
|
268
270
|
system_xml_annotation=self.system_xml_annotation,
|
|
269
271
|
msgpack_annotation=self.msgpack_annotation,
|
|
272
|
+
cbor_annotation=self.cbor_annotation,
|
|
270
273
|
json_match_clauses=self.create_is_json_match_clauses(avro_schema, avro_namespace, class_name)
|
|
271
274
|
)
|
|
272
275
|
|
|
@@ -768,6 +771,10 @@ class AvroToCSharp:
|
|
|
768
771
|
if self.msgpack_annotation:
|
|
769
772
|
prop += f"{INDENT}[Key({field_index})]\n"
|
|
770
773
|
|
|
774
|
+
# Add CBOR serialization attribute if enabled
|
|
775
|
+
if self.cbor_annotation:
|
|
776
|
+
prop += f"{INDENT}[Dahomey.Cbor.Attributes.CborProperty(\"{annotation_name}\")]\n"
|
|
777
|
+
|
|
771
778
|
if self.system_text_json_annotation:
|
|
772
779
|
prop += f"{INDENT}[System.Text.Json.Serialization.JsonPropertyName(\"{annotation_name}\")]\n"
|
|
773
780
|
if is_enum_type:
|
|
@@ -831,6 +838,8 @@ class AvroToCSharp:
|
|
|
831
838
|
file_content += "using System.Xml.Serialization;\n"
|
|
832
839
|
if self.msgpack_annotation: # Add MessagePack serialization using directive
|
|
833
840
|
file_content += "using MessagePack;\n"
|
|
841
|
+
if self.cbor_annotation: # Add CBOR serialization using directive
|
|
842
|
+
file_content += "using Dahomey.Cbor.Attributes;\n"
|
|
834
843
|
|
|
835
844
|
if namespace:
|
|
836
845
|
# Namespace declaration with correct indentation for the definition
|
|
@@ -874,7 +883,8 @@ class AvroToCSharp:
|
|
|
874
883
|
system_text_json_annotation=self.system_text_json_annotation,
|
|
875
884
|
newtonsoft_json_annotation=self.newtonsoft_json_annotation,
|
|
876
885
|
protobuf_net_annotation=self.protobuf_net_annotation,
|
|
877
|
-
msgpack_annotation=self.msgpack_annotation
|
|
886
|
+
msgpack_annotation=self.msgpack_annotation,
|
|
887
|
+
cbor_annotation=self.cbor_annotation
|
|
878
888
|
)
|
|
879
889
|
elif type_kind == "enum":
|
|
880
890
|
test_class_definition = process_template(
|
|
@@ -1028,12 +1038,14 @@ class AvroToCSharp:
|
|
|
1028
1038
|
newtonsoft_json_annotation=self.newtonsoft_json_annotation,
|
|
1029
1039
|
protobuf_net_annotation=self.protobuf_net_annotation,
|
|
1030
1040
|
msgpack_annotation=self.msgpack_annotation,
|
|
1041
|
+
cbor_annotation=self.cbor_annotation,
|
|
1031
1042
|
CSHARP_AVRO_VERSION=CSHARP_AVRO_VERSION,
|
|
1032
1043
|
NEWTONSOFT_JSON_VERSION=NEWTONSOFT_JSON_VERSION,
|
|
1033
1044
|
SYSTEM_TEXT_JSON_VERSION=SYSTEM_TEXT_JSON_VERSION,
|
|
1034
1045
|
SYSTEM_MEMORY_DATA_VERSION=SYSTEM_MEMORY_DATA_VERSION,
|
|
1035
1046
|
PROTOBUF_NET_VERSION=PROTOBUF_NET_VERSION,
|
|
1036
1047
|
MSGPACK_VERSION=MSGPACK_VERSION,
|
|
1048
|
+
CBOR_VERSION=CBOR_VERSION,
|
|
1037
1049
|
NUNIT_VERSION=NUNIT_VERSION,
|
|
1038
1050
|
NUNIT_ADAPTER_VERSION=NUNIT_ADAPTER_VERSION,
|
|
1039
1051
|
MSTEST_SDK_VERSION=MSTEST_SDK_VERSION))
|
|
@@ -1107,6 +1119,7 @@ def convert_avro_to_csharp(
|
|
|
1107
1119
|
newtonsoft_json_annotation=False,
|
|
1108
1120
|
system_xml_annotation=False,
|
|
1109
1121
|
msgpack_annotation=False,
|
|
1122
|
+
cbor_annotation=False,
|
|
1110
1123
|
avro_annotation=False,
|
|
1111
1124
|
protobuf_net_annotation=False
|
|
1112
1125
|
):
|
|
@@ -1122,6 +1135,7 @@ def convert_avro_to_csharp(
|
|
|
1122
1135
|
newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
|
|
1123
1136
|
system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
|
|
1124
1137
|
msgpack_annotation (bool, optional): Use MessagePack annotations. Defaults to False.
|
|
1138
|
+
cbor_annotation (bool, optional): Use Dahomey.Cbor annotations. Defaults to False.
|
|
1125
1139
|
avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
|
|
1126
1140
|
protobuf_net_annotation (bool, optional): Use protobuf-net annotations. Defaults to False.
|
|
1127
1141
|
"""
|
|
@@ -1135,6 +1149,7 @@ def convert_avro_to_csharp(
|
|
|
1135
1149
|
avrotocs.newtonsoft_json_annotation = newtonsoft_json_annotation
|
|
1136
1150
|
avrotocs.system_xml_annotation = system_xml_annotation
|
|
1137
1151
|
avrotocs.msgpack_annotation = msgpack_annotation
|
|
1152
|
+
avrotocs.cbor_annotation = cbor_annotation
|
|
1138
1153
|
avrotocs.avro_annotation = avro_annotation
|
|
1139
1154
|
avrotocs.protobuf_net_annotation = protobuf_net_annotation
|
|
1140
1155
|
avrotocs.convert(avro_schema_path, cs_file_path)
|
|
@@ -1150,6 +1165,7 @@ def convert_avro_schema_to_csharp(
|
|
|
1150
1165
|
newtonsoft_json_annotation: bool = False,
|
|
1151
1166
|
system_xml_annotation: bool = False,
|
|
1152
1167
|
msgpack_annotation: bool = False,
|
|
1168
|
+
cbor_annotation: bool = False,
|
|
1153
1169
|
avro_annotation: bool = False,
|
|
1154
1170
|
protobuf_net_annotation: bool = False
|
|
1155
1171
|
):
|
|
@@ -1165,6 +1181,7 @@ def convert_avro_schema_to_csharp(
|
|
|
1165
1181
|
newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
|
|
1166
1182
|
system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
|
|
1167
1183
|
msgpack_annotation (bool, optional): Use MessagePack annotations. Defaults to False.
|
|
1184
|
+
cbor_annotation (bool, optional): Use Dahomey.Cbor annotations. Defaults to False.
|
|
1168
1185
|
avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
|
|
1169
1186
|
protobuf_net_annotation (bool, optional): Use protobuf-net annotations. Defaults to False.
|
|
1170
1187
|
"""
|
|
@@ -1175,6 +1192,7 @@ def convert_avro_schema_to_csharp(
|
|
|
1175
1192
|
avrotocs.newtonsoft_json_annotation = newtonsoft_json_annotation
|
|
1176
1193
|
avrotocs.system_xml_annotation = system_xml_annotation
|
|
1177
1194
|
avrotocs.msgpack_annotation = msgpack_annotation
|
|
1195
|
+
avrotocs.cbor_annotation = cbor_annotation
|
|
1178
1196
|
avrotocs.avro_annotation = avro_annotation
|
|
1179
1197
|
avrotocs.protobuf_net_annotation = protobuf_net_annotation
|
|
1180
1198
|
avrotocs.convert_schema(avro_schema, output_dir)
|
|
@@ -39,7 +39,23 @@ class AvroToCSVSchemaConverter:
|
|
|
39
39
|
|
|
40
40
|
:param avro_schema: Avro schema as a dictionary.
|
|
41
41
|
:return: CSV schema as a dictionary.
|
|
42
|
+
:raises ValueError: If the schema is not a single record type.
|
|
42
43
|
"""
|
|
44
|
+
# Handle schema arrays (unions of records) - not supported
|
|
45
|
+
if isinstance(avro_schema, list):
|
|
46
|
+
raise ValueError(
|
|
47
|
+
"CSV schema conversion only supports single record schemas. "
|
|
48
|
+
"The provided schema is an array/union of multiple types. "
|
|
49
|
+
"Use --record-type to specify a single record type if available."
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Ensure it's a record type with fields
|
|
53
|
+
if not isinstance(avro_schema, dict) or 'fields' not in avro_schema:
|
|
54
|
+
raise ValueError(
|
|
55
|
+
"CSV schema conversion only supports Avro record types with 'fields'. "
|
|
56
|
+
f"The provided schema has type: {avro_schema.get('type', 'unknown') if isinstance(avro_schema, dict) else type(avro_schema).__name__}"
|
|
57
|
+
)
|
|
58
|
+
|
|
43
59
|
csv_schema = {
|
|
44
60
|
"fields": []
|
|
45
61
|
}
|
|
@@ -649,6 +649,108 @@
|
|
|
649
649
|
}
|
|
650
650
|
]
|
|
651
651
|
},
|
|
652
|
+
{
|
|
653
|
+
"command": "s2k",
|
|
654
|
+
"description": "Convert JSON Structure schema to Kusto table schemas",
|
|
655
|
+
"group": "4_RTDB",
|
|
656
|
+
"function": {
|
|
657
|
+
"name": "avrotize.structuretokusto.convert_structure_to_kusto",
|
|
658
|
+
"args": {
|
|
659
|
+
"structure_schema_path": "input_file_path",
|
|
660
|
+
"kusto_file_path": "output_file_path",
|
|
661
|
+
"kusto_uri": "args.kusto_uri",
|
|
662
|
+
"kusto_database": "args.kusto_database",
|
|
663
|
+
"structure_record_type": "args.record_type",
|
|
664
|
+
"emit_cloudevents_columns": "args.emit_cloudevents_columns",
|
|
665
|
+
"emit_cloudevents_dispatch_table": "args.emit_cloudevents_dispatch"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
"extensions": [
|
|
669
|
+
".struct.json",
|
|
670
|
+
".json"
|
|
671
|
+
],
|
|
672
|
+
"args": [
|
|
673
|
+
{
|
|
674
|
+
"name": "input",
|
|
675
|
+
"type": "str",
|
|
676
|
+
"nargs": "?",
|
|
677
|
+
"help": "Path to the JSON Structure schema file (or read from stdin if omitted)",
|
|
678
|
+
"required": false
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "--out",
|
|
682
|
+
"type": "str",
|
|
683
|
+
"help": "Path to the Kusto table schema file",
|
|
684
|
+
"required": false
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
"name": "--struct",
|
|
688
|
+
"type": "str",
|
|
689
|
+
"help": "Deprecated: Path to the JSON Structure schema file (for backcompat)",
|
|
690
|
+
"required": false
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"name": "--kusto-uri",
|
|
694
|
+
"type": "str",
|
|
695
|
+
"help": "Kusto Cluster URI to apply the generated schema to.",
|
|
696
|
+
"required": false
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"name": "--kusto-database",
|
|
700
|
+
"type": "str",
|
|
701
|
+
"help": "Kusto database name to apply the generated schema to",
|
|
702
|
+
"required": false
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "--record-type",
|
|
706
|
+
"type": "str",
|
|
707
|
+
"help": "Record type in the JSON Structure schema",
|
|
708
|
+
"required": false
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
"name": "--emit-cloudevents-columns",
|
|
712
|
+
"type": "bool",
|
|
713
|
+
"help": "Add CloudEvents columns to the Kusto table",
|
|
714
|
+
"default": false,
|
|
715
|
+
"required": false
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
"name": "--emit-cloudevents-dispatch",
|
|
719
|
+
"type": "bool",
|
|
720
|
+
"help": "Emit a _cloudevents_dispatch ingestion table and update policies for each generated table",
|
|
721
|
+
"required": false
|
|
722
|
+
}
|
|
723
|
+
],
|
|
724
|
+
"suggested_output_file_path": "{input_file_name}.kql",
|
|
725
|
+
"prompts": [
|
|
726
|
+
{
|
|
727
|
+
"name": "--kusto-uri",
|
|
728
|
+
"message": "Enter the Kusto Cluster URI (optional)",
|
|
729
|
+
"type": "str",
|
|
730
|
+
"required": false
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "--kusto-database",
|
|
734
|
+
"message": "Enter the Kusto database name (optional)",
|
|
735
|
+
"type": "str",
|
|
736
|
+
"required": false
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
"name": "--emit-cloudevents-columns",
|
|
740
|
+
"message": "Add CloudEvents columns to the Kusto table?",
|
|
741
|
+
"type": "bool",
|
|
742
|
+
"default": false,
|
|
743
|
+
"required": false
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "--emit-cloudevents-dispatch",
|
|
747
|
+
"message": "Emit a _cloudevents_dispatch ingestion table and update policies?",
|
|
748
|
+
"type": "bool",
|
|
749
|
+
"default": false,
|
|
750
|
+
"required": false
|
|
751
|
+
}
|
|
752
|
+
]
|
|
753
|
+
},
|
|
652
754
|
{
|
|
653
755
|
"command": "k2a",
|
|
654
756
|
"description": "Convert Kusto schema to Avrotize schema",
|
|
@@ -836,7 +938,7 @@
|
|
|
836
938
|
]
|
|
837
939
|
},
|
|
838
940
|
{
|
|
839
|
-
"command": "
|
|
941
|
+
"command": "s2sql",
|
|
840
942
|
"description": "Convert JSON Structure schema to SQL schema",
|
|
841
943
|
"group": "5_SQL",
|
|
842
944
|
"function": {
|
|
@@ -1255,6 +1357,8 @@
|
|
|
1255
1357
|
"system_text_json_annotation": "args.system_text_json_annotation",
|
|
1256
1358
|
"newtonsoft_json_annotation": "args.newtonsoft_json_annotation",
|
|
1257
1359
|
"system_xml_annotation": "args.system_xml_annotation",
|
|
1360
|
+
"msgpack_annotation": "args.msgpack_annotation",
|
|
1361
|
+
"cbor_annotation": "args.cbor_annotation",
|
|
1258
1362
|
"pascal_properties": "args.pascal_properties",
|
|
1259
1363
|
"base_namespace": "args.namespace"
|
|
1260
1364
|
}
|
|
@@ -1323,6 +1427,20 @@
|
|
|
1323
1427
|
"default": false,
|
|
1324
1428
|
"required": false
|
|
1325
1429
|
},
|
|
1430
|
+
{
|
|
1431
|
+
"name": "--msgpack-annotation",
|
|
1432
|
+
"type": "bool",
|
|
1433
|
+
"help": "Use MessagePack annotations",
|
|
1434
|
+
"default": false,
|
|
1435
|
+
"required": false
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
"name": "--cbor-annotation",
|
|
1439
|
+
"type": "bool",
|
|
1440
|
+
"help": "Use Dahomey.Cbor annotations",
|
|
1441
|
+
"default": false,
|
|
1442
|
+
"required": false
|
|
1443
|
+
},
|
|
1326
1444
|
{
|
|
1327
1445
|
"name": "--pascal-properties",
|
|
1328
1446
|
"type": "bool",
|
|
@@ -1375,6 +1493,7 @@
|
|
|
1375
1493
|
"system_text_json_annotation": "args.system_text_json_annotation",
|
|
1376
1494
|
"newtonsoft_json_annotation": "args.newtonsoft_json_annotation",
|
|
1377
1495
|
"system_xml_annotation": "args.system_xml_annotation",
|
|
1496
|
+
"avro_annotation": "args.avro_annotation",
|
|
1378
1497
|
"pascal_properties": "args.pascal_properties",
|
|
1379
1498
|
"base_namespace": "args.namespace",
|
|
1380
1499
|
"project_name": "args.project_name"
|
|
@@ -1437,6 +1556,13 @@
|
|
|
1437
1556
|
"default": false,
|
|
1438
1557
|
"required": false
|
|
1439
1558
|
},
|
|
1559
|
+
{
|
|
1560
|
+
"name": "--avro-annotation",
|
|
1561
|
+
"type": "bool",
|
|
1562
|
+
"help": "Use Avro annotations",
|
|
1563
|
+
"default": false,
|
|
1564
|
+
"required": false
|
|
1565
|
+
},
|
|
1440
1566
|
{
|
|
1441
1567
|
"name": "--pascal-properties",
|
|
1442
1568
|
"type": "bool",
|
|
@@ -1468,6 +1594,13 @@
|
|
|
1468
1594
|
"default": false,
|
|
1469
1595
|
"required": false
|
|
1470
1596
|
},
|
|
1597
|
+
{
|
|
1598
|
+
"name": "--avro-annotation",
|
|
1599
|
+
"message": "Use Avro annotations?",
|
|
1600
|
+
"type": "bool",
|
|
1601
|
+
"default": false,
|
|
1602
|
+
"required": false
|
|
1603
|
+
},
|
|
1471
1604
|
{
|
|
1472
1605
|
"name": "--pascal-properties",
|
|
1473
1606
|
"message": "Use PascalCase properties?",
|
|
@@ -1790,6 +1923,44 @@
|
|
|
1790
1923
|
"suggested_output_file_path": "{input_file_name}.csv.json",
|
|
1791
1924
|
"prompts": []
|
|
1792
1925
|
},
|
|
1926
|
+
{
|
|
1927
|
+
"command": "a2csv",
|
|
1928
|
+
"description": "Convert Avrotize schema to CSV schema",
|
|
1929
|
+
"group": "1_Schemas",
|
|
1930
|
+
"function": {
|
|
1931
|
+
"name": "avrotize.avrotocsv.convert_avro_to_csv_schema",
|
|
1932
|
+
"args": {
|
|
1933
|
+
"avro_schema_path": "input_file_path",
|
|
1934
|
+
"csv_schema_path": "output_file_path"
|
|
1935
|
+
}
|
|
1936
|
+
},
|
|
1937
|
+
"extensions": [
|
|
1938
|
+
".avsc"
|
|
1939
|
+
],
|
|
1940
|
+
"args": [
|
|
1941
|
+
{
|
|
1942
|
+
"name": "input",
|
|
1943
|
+
"type": "str",
|
|
1944
|
+
"nargs": "?",
|
|
1945
|
+
"help": "Path to the Avrotize schema file (or read from stdin if omitted)",
|
|
1946
|
+
"required": false
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"name": "--out",
|
|
1950
|
+
"type": "str",
|
|
1951
|
+
"help": "Output path for the CSV schema file",
|
|
1952
|
+
"required": false
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
"name": "--avsc",
|
|
1956
|
+
"type": "str",
|
|
1957
|
+
"help": "Deprecated: Path to the Avrotize schema file (for backcompat)",
|
|
1958
|
+
"required": false
|
|
1959
|
+
}
|
|
1960
|
+
],
|
|
1961
|
+
"suggested_output_file_path": "{input_file_name}.csv.json",
|
|
1962
|
+
"prompts": []
|
|
1963
|
+
},
|
|
1793
1964
|
{
|
|
1794
1965
|
"command": "s2rust",
|
|
1795
1966
|
"description": "Convert JSON Structure to Rust classes",
|
|
@@ -2116,7 +2287,7 @@
|
|
|
2116
2287
|
]
|
|
2117
2288
|
},
|
|
2118
2289
|
{
|
|
2119
|
-
"command": "
|
|
2290
|
+
"command": "s2graphql",
|
|
2120
2291
|
"description": "Convert JSON Structure schema to GraphQL schema",
|
|
2121
2292
|
"group": "1_Schemas",
|
|
2122
2293
|
"function": {
|
|
@@ -2148,6 +2319,44 @@
|
|
|
2148
2319
|
"suggested_output_file_path": "{input_file_name}.graphql",
|
|
2149
2320
|
"prompts": []
|
|
2150
2321
|
},
|
|
2322
|
+
{
|
|
2323
|
+
"command": "a2graphql",
|
|
2324
|
+
"description": "Convert Avrotize schema to GraphQL schema",
|
|
2325
|
+
"group": "1_Schemas",
|
|
2326
|
+
"function": {
|
|
2327
|
+
"name": "avrotize.avrotographql.convert_avro_to_graphql",
|
|
2328
|
+
"args": {
|
|
2329
|
+
"avro_schema_path": "input_file_path",
|
|
2330
|
+
"graphql_schema_path": "output_file_path"
|
|
2331
|
+
}
|
|
2332
|
+
},
|
|
2333
|
+
"extensions": [
|
|
2334
|
+
".avsc"
|
|
2335
|
+
],
|
|
2336
|
+
"args": [
|
|
2337
|
+
{
|
|
2338
|
+
"name": "input",
|
|
2339
|
+
"type": "str",
|
|
2340
|
+
"nargs": "?",
|
|
2341
|
+
"help": "Path to the Avrotize schema file (or read from stdin if omitted)",
|
|
2342
|
+
"required": false
|
|
2343
|
+
},
|
|
2344
|
+
{
|
|
2345
|
+
"name": "--out",
|
|
2346
|
+
"type": "str",
|
|
2347
|
+
"help": "Path to the GraphQL schema file",
|
|
2348
|
+
"required": false
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
"name": "--avsc",
|
|
2352
|
+
"type": "str",
|
|
2353
|
+
"help": "Deprecated: Path to the Avrotize schema file (for backcompat)",
|
|
2354
|
+
"required": false
|
|
2355
|
+
}
|
|
2356
|
+
],
|
|
2357
|
+
"suggested_output_file_path": "{input_file_name}.graphql",
|
|
2358
|
+
"prompts": []
|
|
2359
|
+
},
|
|
2151
2360
|
{
|
|
2152
2361
|
"command": "a2ts",
|
|
2153
2362
|
"description": "Convert Avrotize schema to TypeScript classes",
|
|
@@ -2793,7 +3002,7 @@
|
|
|
2793
3002
|
]
|
|
2794
3003
|
},
|
|
2795
3004
|
{
|
|
2796
|
-
"command": "
|
|
3005
|
+
"command": "s2cassandra",
|
|
2797
3006
|
"description": "Convert JSON Structure schema to Cassandra schema",
|
|
2798
3007
|
"group": "5_SQL",
|
|
2799
3008
|
"function": {
|
|
@@ -3337,7 +3546,7 @@
|
|
|
3337
3546
|
"prompts": []
|
|
3338
3547
|
},
|
|
3339
3548
|
{
|
|
3340
|
-
"command": "
|
|
3549
|
+
"command": "s2md",
|
|
3341
3550
|
"description": "Convert JSON Structure schema to Markdown documentation",
|
|
3342
3551
|
"group": "7_Utility",
|
|
3343
3552
|
"function": {
|
|
@@ -70,6 +70,11 @@ try:
|
|
|
70
70
|
except ValueError:
|
|
71
71
|
MSGPACK_VERSION = '2.5.187'
|
|
72
72
|
|
|
73
|
+
try:
|
|
74
|
+
CBOR_VERSION = get_dependency_version('cs', 'net90', 'Dahomey.Cbor')
|
|
75
|
+
except ValueError:
|
|
76
|
+
CBOR_VERSION = '1.25.1'
|
|
77
|
+
|
|
73
78
|
# Java test dependencies
|
|
74
79
|
try:
|
|
75
80
|
JUNIT_VERSION = get_dependency_version('java', 'jdk21', 'org.junit.jupiter:junit-jupiter-api')
|
|
@@ -9,10 +9,12 @@ from typing import Any, Dict, List, Tuple, Union, cast, Optional
|
|
|
9
9
|
import uuid
|
|
10
10
|
|
|
11
11
|
from avrotize.common import pascal, process_template
|
|
12
|
+
from avrotize.jstructtoavro import JsonStructureToAvro
|
|
12
13
|
from avrotize.constants import (
|
|
13
14
|
NEWTONSOFT_JSON_VERSION,
|
|
14
15
|
SYSTEM_TEXT_JSON_VERSION,
|
|
15
16
|
SYSTEM_MEMORY_DATA_VERSION,
|
|
17
|
+
CSHARP_AVRO_VERSION,
|
|
16
18
|
NUNIT_VERSION,
|
|
17
19
|
NUNIT_ADAPTER_VERSION,
|
|
18
20
|
MSTEST_SDK_VERSION,
|
|
@@ -37,6 +39,7 @@ class StructureToCSharp:
|
|
|
37
39
|
self.system_text_json_annotation = False
|
|
38
40
|
self.newtonsoft_json_annotation = False
|
|
39
41
|
self.system_xml_annotation = False
|
|
42
|
+
self.avro_annotation = False
|
|
40
43
|
self.generated_types: Dict[str,str] = {}
|
|
41
44
|
self.generated_structure_types: Dict[str, Dict[str, Union[str, Dict, List]]] = {}
|
|
42
45
|
self.type_dict: Dict[str, Dict] = {}
|
|
@@ -419,14 +422,30 @@ class StructureToCSharp:
|
|
|
419
422
|
constructor_modifier = "protected" if is_abstract else "public"
|
|
420
423
|
class_definition += f"{INDENT}{constructor_modifier} {class_name}()\n{INDENT}{{\n{INDENT}}}"
|
|
421
424
|
|
|
425
|
+
# Convert JSON Structure schema to Avro schema if avro_annotation is enabled
|
|
426
|
+
avro_schema_json = ''
|
|
427
|
+
if self.avro_annotation:
|
|
428
|
+
# Use JsonStructureToAvro to convert the schema
|
|
429
|
+
converter = JsonStructureToAvro()
|
|
430
|
+
schema_copy = structure_schema.copy()
|
|
431
|
+
avro_schema = converter.convert(schema_copy)
|
|
432
|
+
# Escape the JSON for C# string literal
|
|
433
|
+
# json.dumps produces compact JSON that only needs backslash and quote escaping
|
|
434
|
+
avro_schema_json = json.dumps(avro_schema, separators=(',', ':')).replace('\\', '\\\\').replace('"', '\\"')
|
|
435
|
+
# Also enable system_text_json_annotation internally for Avro serialization helpers
|
|
436
|
+
# since ToAvroRecord and FromAvroRecord use System.Text.Json
|
|
437
|
+
needs_json_for_avro = not self.system_text_json_annotation and not self.newtonsoft_json_annotation
|
|
438
|
+
|
|
422
439
|
# Add helper methods from template if any annotations are enabled
|
|
423
|
-
if self.system_text_json_annotation or self.newtonsoft_json_annotation or self.system_xml_annotation:
|
|
440
|
+
if self.system_text_json_annotation or self.newtonsoft_json_annotation or self.system_xml_annotation or self.avro_annotation:
|
|
424
441
|
class_definition += process_template(
|
|
425
442
|
"structuretocsharp/dataclass_core.jinja",
|
|
426
443
|
class_name=class_name,
|
|
427
|
-
system_text_json_annotation=self.system_text_json_annotation,
|
|
444
|
+
system_text_json_annotation=self.system_text_json_annotation or (self.avro_annotation and needs_json_for_avro),
|
|
428
445
|
newtonsoft_json_annotation=self.newtonsoft_json_annotation,
|
|
429
|
-
system_xml_annotation=self.system_xml_annotation
|
|
446
|
+
system_xml_annotation=self.system_xml_annotation,
|
|
447
|
+
avro_annotation=self.avro_annotation,
|
|
448
|
+
avro_schema_json=avro_schema_json
|
|
430
449
|
)
|
|
431
450
|
|
|
432
451
|
# Generate Equals and GetHashCode
|
|
@@ -522,18 +541,39 @@ class StructureToCSharp:
|
|
|
522
541
|
self.needs_json_structure_converters = True
|
|
523
542
|
|
|
524
543
|
# Add validation attributes based on schema constraints
|
|
525
|
-
#
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
544
|
+
# Get the property type to determine which attributes to apply
|
|
545
|
+
prop_type_base = prop_schema.get('type', '')
|
|
546
|
+
if isinstance(prop_type_base, list):
|
|
547
|
+
# Handle type unions - use the first non-null type
|
|
548
|
+
non_null_types = [t for t in prop_type_base if t != 'null']
|
|
549
|
+
prop_type_base = non_null_types[0] if non_null_types else ''
|
|
550
|
+
|
|
551
|
+
# EmailAddress attribute for format: "email"
|
|
552
|
+
if prop_schema.get('format') == 'email':
|
|
553
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.EmailAddress]\n'
|
|
554
|
+
|
|
555
|
+
# String length constraints (for string types)
|
|
556
|
+
if prop_type_base == 'string' or (not prop_type_base and ('minLength' in prop_schema or 'maxLength' in prop_schema)):
|
|
557
|
+
if 'maxLength' in prop_schema:
|
|
558
|
+
max_length = prop_schema['maxLength']
|
|
559
|
+
if 'minLength' in prop_schema:
|
|
560
|
+
min_length = prop_schema['minLength']
|
|
561
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.StringLength({max_length}, MinimumLength = {min_length})]\n'
|
|
562
|
+
else:
|
|
563
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.StringLength({max_length})]\n'
|
|
564
|
+
elif 'minLength' in prop_schema:
|
|
565
|
+
# MinLength only (no max)
|
|
529
566
|
min_length = prop_schema['minLength']
|
|
530
|
-
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
567
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.MinLength({min_length})]\n'
|
|
568
|
+
|
|
569
|
+
# Array length constraints (for array types)
|
|
570
|
+
if prop_type_base == 'array':
|
|
571
|
+
if 'minItems' in prop_schema:
|
|
572
|
+
min_items = prop_schema['minItems']
|
|
573
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.MinLength({min_items})]\n'
|
|
574
|
+
if 'maxItems' in prop_schema:
|
|
575
|
+
max_items = prop_schema['maxItems']
|
|
576
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.MaxLength({max_items})]\n'
|
|
537
577
|
|
|
538
578
|
# RegularExpression attribute for pattern
|
|
539
579
|
if 'pattern' in prop_schema:
|
|
@@ -541,22 +581,49 @@ class StructureToCSharp:
|
|
|
541
581
|
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.RegularExpression(@"{pattern}")]\n'
|
|
542
582
|
|
|
543
583
|
# Range attribute for minimum/maximum on numeric types
|
|
544
|
-
if 'minimum' in prop_schema or 'maximum' in prop_schema:
|
|
545
|
-
|
|
546
|
-
|
|
584
|
+
if 'minimum' in prop_schema or 'maximum' in prop_schema or 'exclusiveMinimum' in prop_schema or 'exclusiveMaximum' in prop_schema:
|
|
585
|
+
# Determine the minimum and maximum values
|
|
586
|
+
has_min = 'minimum' in prop_schema
|
|
587
|
+
has_max = 'maximum' in prop_schema
|
|
588
|
+
has_exclusive_min = 'exclusiveMinimum' in prop_schema
|
|
589
|
+
has_exclusive_max = 'exclusiveMaximum' in prop_schema
|
|
547
590
|
|
|
548
|
-
#
|
|
549
|
-
if
|
|
550
|
-
|
|
591
|
+
# Use minimum/maximum if present, otherwise use exclusiveMinimum/exclusiveMaximum
|
|
592
|
+
if has_min:
|
|
593
|
+
min_val = prop_schema['minimum']
|
|
594
|
+
min_is_exclusive = False
|
|
595
|
+
elif has_exclusive_min:
|
|
596
|
+
min_val = prop_schema['exclusiveMinimum']
|
|
597
|
+
min_is_exclusive = True
|
|
551
598
|
else:
|
|
552
|
-
|
|
599
|
+
min_val = 'double.MinValue'
|
|
600
|
+
min_is_exclusive = False
|
|
553
601
|
|
|
554
|
-
if
|
|
555
|
-
|
|
602
|
+
if has_max:
|
|
603
|
+
max_val = prop_schema['maximum']
|
|
604
|
+
max_is_exclusive = False
|
|
605
|
+
elif has_exclusive_max:
|
|
606
|
+
max_val = prop_schema['exclusiveMaximum']
|
|
607
|
+
max_is_exclusive = True
|
|
556
608
|
else:
|
|
557
|
-
|
|
609
|
+
max_val = 'double.MaxValue'
|
|
610
|
+
max_is_exclusive = False
|
|
611
|
+
|
|
612
|
+
# Convert to appropriate format
|
|
613
|
+
min_str = str(min_val)
|
|
614
|
+
max_str = str(max_val)
|
|
558
615
|
|
|
559
|
-
|
|
616
|
+
# Build the Range attribute with exclusive parameters if needed
|
|
617
|
+
range_params = f'{min_str}, {max_str}'
|
|
618
|
+
if min_is_exclusive or max_is_exclusive:
|
|
619
|
+
extra_params = []
|
|
620
|
+
if min_is_exclusive:
|
|
621
|
+
extra_params.append('MinimumIsExclusive = true')
|
|
622
|
+
if max_is_exclusive:
|
|
623
|
+
extra_params.append('MaximumIsExclusive = true')
|
|
624
|
+
range_params += ', ' + ', '.join(extra_params)
|
|
625
|
+
|
|
626
|
+
property_definition += f'{INDENT}[System.ComponentModel.DataAnnotations.Range({range_params})]\n'
|
|
560
627
|
|
|
561
628
|
# Add Obsolete attribute if deprecated
|
|
562
629
|
if prop_schema.get('deprecated', False):
|
|
@@ -1486,6 +1553,10 @@ class StructureToCSharp:
|
|
|
1486
1553
|
file_content += "using Newtonsoft.Json;\n"
|
|
1487
1554
|
if self.system_xml_annotation: # Add XML serialization using directive
|
|
1488
1555
|
file_content += "using System.Xml.Serialization;\n"
|
|
1556
|
+
if self.avro_annotation: # Add Avro using directives
|
|
1557
|
+
file_content += "using Avro;\n"
|
|
1558
|
+
file_content += "using Avro.Generic;\n"
|
|
1559
|
+
file_content += "using Avro.IO;\n"
|
|
1489
1560
|
|
|
1490
1561
|
if namespace:
|
|
1491
1562
|
# Namespace declaration with correct indentation for the definition
|
|
@@ -1560,11 +1631,14 @@ class StructureToCSharp:
|
|
|
1560
1631
|
"structuretocsharp/project.csproj.jinja",
|
|
1561
1632
|
project_name=project_name,
|
|
1562
1633
|
system_xml_annotation=self.system_xml_annotation,
|
|
1563
|
-
|
|
1634
|
+
# Avro annotation requires System.Text.Json for intermediate conversions
|
|
1635
|
+
system_text_json_annotation=self.system_text_json_annotation or self.avro_annotation,
|
|
1564
1636
|
newtonsoft_json_annotation=self.newtonsoft_json_annotation,
|
|
1637
|
+
avro_annotation=self.avro_annotation,
|
|
1565
1638
|
NEWTONSOFT_JSON_VERSION=NEWTONSOFT_JSON_VERSION,
|
|
1566
1639
|
SYSTEM_TEXT_JSON_VERSION=SYSTEM_TEXT_JSON_VERSION,
|
|
1567
1640
|
SYSTEM_MEMORY_DATA_VERSION=SYSTEM_MEMORY_DATA_VERSION,
|
|
1641
|
+
CSHARP_AVRO_VERSION=CSHARP_AVRO_VERSION,
|
|
1568
1642
|
NUNIT_VERSION=NUNIT_VERSION,
|
|
1569
1643
|
NUNIT_ADAPTER_VERSION=NUNIT_ADAPTER_VERSION,
|
|
1570
1644
|
MSTEST_SDK_VERSION=MSTEST_SDK_VERSION))
|
|
@@ -2268,7 +2342,8 @@ def convert_structure_to_csharp(
|
|
|
2268
2342
|
pascal_properties: bool = False,
|
|
2269
2343
|
system_text_json_annotation: bool = False,
|
|
2270
2344
|
newtonsoft_json_annotation: bool = False,
|
|
2271
|
-
system_xml_annotation: bool = False
|
|
2345
|
+
system_xml_annotation: bool = False,
|
|
2346
|
+
avro_annotation: bool = False
|
|
2272
2347
|
):
|
|
2273
2348
|
"""Converts JSON Structure schema to C# classes
|
|
2274
2349
|
|
|
@@ -2281,6 +2356,7 @@ def convert_structure_to_csharp(
|
|
|
2281
2356
|
system_text_json_annotation (bool, optional): Use System.Text.Json annotations. Defaults to False.
|
|
2282
2357
|
newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
|
|
2283
2358
|
system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
|
|
2359
|
+
avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
|
|
2284
2360
|
"""
|
|
2285
2361
|
|
|
2286
2362
|
if not base_namespace:
|
|
@@ -2292,6 +2368,7 @@ def convert_structure_to_csharp(
|
|
|
2292
2368
|
structtocs.system_text_json_annotation = system_text_json_annotation
|
|
2293
2369
|
structtocs.newtonsoft_json_annotation = newtonsoft_json_annotation
|
|
2294
2370
|
structtocs.system_xml_annotation = system_xml_annotation
|
|
2371
|
+
structtocs.avro_annotation = avro_annotation
|
|
2295
2372
|
structtocs.convert(structure_schema_path, cs_file_path)
|
|
2296
2373
|
|
|
2297
2374
|
|
|
@@ -2303,7 +2380,8 @@ def convert_structure_schema_to_csharp(
|
|
|
2303
2380
|
pascal_properties: bool = False,
|
|
2304
2381
|
system_text_json_annotation: bool = False,
|
|
2305
2382
|
newtonsoft_json_annotation: bool = False,
|
|
2306
|
-
system_xml_annotation: bool = False
|
|
2383
|
+
system_xml_annotation: bool = False,
|
|
2384
|
+
avro_annotation: bool = False
|
|
2307
2385
|
):
|
|
2308
2386
|
"""Converts JSON Structure schema to C# classes
|
|
2309
2387
|
|
|
@@ -2316,6 +2394,7 @@ def convert_structure_schema_to_csharp(
|
|
|
2316
2394
|
system_text_json_annotation (bool, optional): Use System.Text.Json annotations. Defaults to False.
|
|
2317
2395
|
newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
|
|
2318
2396
|
system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
|
|
2397
|
+
avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
|
|
2319
2398
|
"""
|
|
2320
2399
|
structtocs = StructureToCSharp(base_namespace)
|
|
2321
2400
|
structtocs.project_name = project_name
|
|
@@ -2323,4 +2402,5 @@ def convert_structure_schema_to_csharp(
|
|
|
2323
2402
|
structtocs.system_text_json_annotation = system_text_json_annotation
|
|
2324
2403
|
structtocs.newtonsoft_json_annotation = newtonsoft_json_annotation
|
|
2325
2404
|
structtocs.system_xml_annotation = system_xml_annotation
|
|
2405
|
+
structtocs.avro_annotation = avro_annotation
|
|
2326
2406
|
structtocs.convert_schema(structure_schema, output_dir)
|
|
@@ -125,7 +125,7 @@ class StructureToTypeScript:
|
|
|
125
125
|
namespace_package = '.'.join([part.lower() for part in namespace.split('.')]) if namespace else ''
|
|
126
126
|
package = namespace_package
|
|
127
127
|
if self.base_package:
|
|
128
|
-
package = self.base_package + ('.' if package else '') + package
|
|
128
|
+
package = self.base_package.lower() + ('.' if package else '') + package
|
|
129
129
|
return package
|
|
130
130
|
|
|
131
131
|
def typescript_type_from_structure_type(self, type_name: str) -> str:
|
|
@@ -738,4 +738,4 @@ def convert_structure_schema_to_typescript(structure_schema: JsonNode, output_di
|
|
|
738
738
|
avro_annotation: Whether to include Avro annotations
|
|
739
739
|
"""
|
|
740
740
|
converter = StructureToTypeScript(package_name, typedjson_annotation, avro_annotation)
|
|
741
|
-
converter.convert_schema(structure_schema, output_dir, package_name)
|
|
741
|
+
converter.convert_schema(structure_schema, output_dir, package_name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structurize
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Tools to convert from and to JSON Structure from various other schema languages.
|
|
5
5
|
Author-email: Clemens Vasters <clemensv@microsoft.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{structurize-2.22.1 → structurize-3.0.0}/avrotize/dependencies/typescript/node22/package.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|