structurize 2.22.2__tar.gz → 3.0.1__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.
Files changed (81) hide show
  1. {structurize-2.22.2/structurize.egg-info → structurize-3.0.1}/PKG-INFO +1 -1
  2. {structurize-2.22.2 → structurize-3.0.1}/avrotize/_version.py +3 -3
  3. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotocsv.py +16 -0
  4. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotodb.py +4 -1
  5. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotogo.py +4 -4
  6. {structurize-2.22.2 → structurize-3.0.1}/avrotize/commands.json +182 -4
  7. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretots.py +1 -1
  8. {structurize-2.22.2 → structurize-3.0.1/structurize.egg-info}/PKG-INFO +1 -1
  9. {structurize-2.22.2 → structurize-3.0.1}/.gitignore +0 -0
  10. {structurize-2.22.2 → structurize-3.0.1}/LICENSE +0 -0
  11. {structurize-2.22.2 → structurize-3.0.1}/MANIFEST.in +0 -0
  12. {structurize-2.22.2 → structurize-3.0.1}/README.md +0 -0
  13. {structurize-2.22.2 → structurize-3.0.1}/avrotize/__init__.py +0 -0
  14. {structurize-2.22.2 → structurize-3.0.1}/avrotize/__main__.py +0 -0
  15. {structurize-2.22.2 → structurize-3.0.1}/avrotize/asn1toavro.py +0 -0
  16. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotize.py +0 -0
  17. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotocpp.py +0 -0
  18. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotocsharp.py +0 -0
  19. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotodatapackage.py +0 -0
  20. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotographql.py +0 -0
  21. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotoiceberg.py +0 -0
  22. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotojava.py +0 -0
  23. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotojs.py +0 -0
  24. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotojsons.py +0 -0
  25. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotojstruct.py +0 -0
  26. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotokusto.py +0 -0
  27. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotomd.py +0 -0
  28. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotools.py +0 -0
  29. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotoparquet.py +0 -0
  30. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotoproto.py +0 -0
  31. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotopython.py +0 -0
  32. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotorust.py +0 -0
  33. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotots.py +0 -0
  34. {structurize-2.22.2 → structurize-3.0.1}/avrotize/avrotoxsd.py +0 -0
  35. {structurize-2.22.2 → structurize-3.0.1}/avrotize/cddltostructure.py +0 -0
  36. {structurize-2.22.2 → structurize-3.0.1}/avrotize/common.py +0 -0
  37. {structurize-2.22.2 → structurize-3.0.1}/avrotize/constants.py +0 -0
  38. {structurize-2.22.2 → structurize-3.0.1}/avrotize/csvtoavro.py +0 -0
  39. {structurize-2.22.2 → structurize-3.0.1}/avrotize/datapackagetoavro.py +0 -0
  40. {structurize-2.22.2 → structurize-3.0.1}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
  41. {structurize-2.22.2 → structurize-3.0.1}/avrotize/dependencies/typescript/node22/package.json +0 -0
  42. {structurize-2.22.2 → structurize-3.0.1}/avrotize/dependency_resolver.py +0 -0
  43. {structurize-2.22.2 → structurize-3.0.1}/avrotize/dependency_version.py +0 -0
  44. {structurize-2.22.2 → structurize-3.0.1}/avrotize/jsonstoavro.py +0 -0
  45. {structurize-2.22.2 → structurize-3.0.1}/avrotize/jsonstostructure.py +0 -0
  46. {structurize-2.22.2 → structurize-3.0.1}/avrotize/jstructtoavro.py +0 -0
  47. {structurize-2.22.2 → structurize-3.0.1}/avrotize/kstructtoavro.py +0 -0
  48. {structurize-2.22.2 → structurize-3.0.1}/avrotize/kustotoavro.py +0 -0
  49. {structurize-2.22.2 → structurize-3.0.1}/avrotize/openapitostructure.py +0 -0
  50. {structurize-2.22.2 → structurize-3.0.1}/avrotize/parquettoavro.py +0 -0
  51. {structurize-2.22.2 → structurize-3.0.1}/avrotize/proto2parser.py +0 -0
  52. {structurize-2.22.2 → structurize-3.0.1}/avrotize/proto3parser.py +0 -0
  53. {structurize-2.22.2 → structurize-3.0.1}/avrotize/prototoavro.py +0 -0
  54. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretocddl.py +0 -0
  55. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretocpp.py +0 -0
  56. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretocsharp.py +0 -0
  57. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretocsv.py +0 -0
  58. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretodatapackage.py +0 -0
  59. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretodb.py +0 -0
  60. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretogo.py +0 -0
  61. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretographql.py +0 -0
  62. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretoiceberg.py +0 -0
  63. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretojava.py +0 -0
  64. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretojs.py +0 -0
  65. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretojsons.py +0 -0
  66. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretokusto.py +0 -0
  67. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretomd.py +0 -0
  68. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretoproto.py +0 -0
  69. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretopython.py +0 -0
  70. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretorust.py +0 -0
  71. {structurize-2.22.2 → structurize-3.0.1}/avrotize/structuretoxsd.py +0 -0
  72. {structurize-2.22.2 → structurize-3.0.1}/avrotize/xsdtoavro.py +0 -0
  73. {structurize-2.22.2 → structurize-3.0.1}/build.ps1 +0 -0
  74. {structurize-2.22.2 → structurize-3.0.1}/build.sh +0 -0
  75. {structurize-2.22.2 → structurize-3.0.1}/pyproject.toml +0 -0
  76. {structurize-2.22.2 → structurize-3.0.1}/setup.cfg +0 -0
  77. {structurize-2.22.2 → structurize-3.0.1}/structurize.egg-info/SOURCES.txt +0 -0
  78. {structurize-2.22.2 → structurize-3.0.1}/structurize.egg-info/dependency_links.txt +0 -0
  79. {structurize-2.22.2 → structurize-3.0.1}/structurize.egg-info/entry_points.txt +0 -0
  80. {structurize-2.22.2 → structurize-3.0.1}/structurize.egg-info/requires.txt +0 -0
  81. {structurize-2.22.2 → structurize-3.0.1}/structurize.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structurize
3
- Version: 2.22.2
3
+ Version: 3.0.1
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 = '2.22.2'
32
- __version_tuple__ = version_tuple = (2, 22, 2)
31
+ __version__ = version = '3.0.1'
32
+ __version_tuple__ = version_tuple = (3, 0, 1)
33
33
 
34
- __commit_id__ = commit_id = 'g25efcf5da'
34
+ __commit_id__ = commit_id = 'g62e6bb75a'
@@ -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
  }
@@ -685,7 +685,10 @@ def convert_avro_to_nosql(avro_schema_path, nosql_file_path, nosql_dialect, emit
685
685
  file_name = os.path.join(
686
686
  nosql_file_path, get_file_name(schema_list, get_nosql_file_extension(nosql_dialect)))
687
687
  with open(file_name, "w", encoding="utf-8") as nosql_file:
688
- nosql_file.write(model)
688
+ if isinstance(model, list):
689
+ nosql_file.write("\n".join(model))
690
+ else:
691
+ nosql_file.write(model)
689
692
 
690
693
  def get_nosql_file_extension(nosql_dialect):
691
694
  """
@@ -466,8 +466,8 @@ def convert_avro_to_go(avro_schema_path, go_file_path, package_name='', avro_ann
466
466
  avrotogo = AvroToGo(package_name)
467
467
  avrotogo.avro_annotation = avro_annotation
468
468
  avrotogo.json_annotation = json_annotation
469
- avrotogo.package_site = package_site
470
- avrotogo.package_username = package_username
469
+ avrotogo.package_site = package_site if package_site else 'github.com'
470
+ avrotogo.package_username = package_username if package_username else 'username'
471
471
  avrotogo.convert(avro_schema_path, go_file_path)
472
472
 
473
473
 
@@ -484,6 +484,6 @@ def convert_avro_schema_to_go(avro_schema: JsonNode, output_dir: str, package_na
484
484
  avrotogo = AvroToGo(package_name)
485
485
  avrotogo.avro_annotation = avro_annotation
486
486
  avrotogo.json_annotation = json_annotation
487
- avrotogo.package_site = package_site
488
- avrotogo.package_username = package_username
487
+ avrotogo.package_site = package_site if package_site else 'github.com'
488
+ avrotogo.package_username = package_username if package_username else 'username'
489
489
  avrotogo.convert_schema(avro_schema, output_dir)
@@ -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": "struct2sql",
941
+ "command": "s2sql",
840
942
  "description": "Convert JSON Structure schema to SQL schema",
841
943
  "group": "5_SQL",
842
944
  "function": {
@@ -1821,6 +1923,44 @@
1821
1923
  "suggested_output_file_path": "{input_file_name}.csv.json",
1822
1924
  "prompts": []
1823
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
+ },
1824
1964
  {
1825
1965
  "command": "s2rust",
1826
1966
  "description": "Convert JSON Structure to Rust classes",
@@ -2147,7 +2287,7 @@
2147
2287
  ]
2148
2288
  },
2149
2289
  {
2150
- "command": "struct2gql",
2290
+ "command": "s2graphql",
2151
2291
  "description": "Convert JSON Structure schema to GraphQL schema",
2152
2292
  "group": "1_Schemas",
2153
2293
  "function": {
@@ -2179,6 +2319,44 @@
2179
2319
  "suggested_output_file_path": "{input_file_name}.graphql",
2180
2320
  "prompts": []
2181
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
+ },
2182
2360
  {
2183
2361
  "command": "a2ts",
2184
2362
  "description": "Convert Avrotize schema to TypeScript classes",
@@ -2824,7 +3002,7 @@
2824
3002
  ]
2825
3003
  },
2826
3004
  {
2827
- "command": "struct2cassandra",
3005
+ "command": "s2cassandra",
2828
3006
  "description": "Convert JSON Structure schema to Cassandra schema",
2829
3007
  "group": "5_SQL",
2830
3008
  "function": {
@@ -3368,7 +3546,7 @@
3368
3546
  "prompts": []
3369
3547
  },
3370
3548
  {
3371
- "command": "struct2md",
3549
+ "command": "s2md",
3372
3550
  "description": "Convert JSON Structure schema to Markdown documentation",
3373
3551
  "group": "7_Utility",
3374
3552
  "function": {
@@ -32,7 +32,7 @@ class StructureToTypeScript:
32
32
  """ Converts JSON Structure schema to TypeScript classes """
33
33
 
34
34
  def __init__(self, base_package: str = '', typedjson_annotation=False, avro_annotation=False) -> None:
35
- self.base_package = base_package
35
+ self.base_package = base_package or ''
36
36
  self.typedjson_annotation = typedjson_annotation
37
37
  self.avro_annotation = avro_annotation
38
38
  self.output_dir = os.getcwd()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structurize
3
- Version: 2.22.2
3
+ Version: 3.0.1
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