structurize 3.5.4__tar.gz → 3.5.5__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 (90) hide show
  1. {structurize-3.5.4/structurize.egg-info → structurize-3.5.5}/PKG-INFO +1 -1
  2. {structurize-3.5.4 → structurize-3.5.5}/avrotize/_version.py +3 -3
  3. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretopython.py +60 -1
  4. {structurize-3.5.4 → structurize-3.5.5/structurize.egg-info}/PKG-INFO +1 -1
  5. {structurize-3.5.4 → structurize-3.5.5}/.gitignore +0 -0
  6. {structurize-3.5.4 → structurize-3.5.5}/LICENSE +0 -0
  7. {structurize-3.5.4 → structurize-3.5.5}/MANIFEST.in +0 -0
  8. {structurize-3.5.4 → structurize-3.5.5}/README.md +0 -0
  9. {structurize-3.5.4 → structurize-3.5.5}/avrotize/__init__.py +0 -0
  10. {structurize-3.5.4 → structurize-3.5.5}/avrotize/__main__.py +0 -0
  11. {structurize-3.5.4 → structurize-3.5.5}/avrotize/asn1toavro.py +0 -0
  12. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotize.py +0 -0
  13. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotocpp.py +0 -0
  14. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotocsharp.py +0 -0
  15. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotocsv.py +0 -0
  16. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotodatapackage.py +0 -0
  17. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotodb.py +0 -0
  18. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotogo.py +0 -0
  19. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotographql.py +0 -0
  20. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotoiceberg.py +0 -0
  21. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotojava.py +0 -0
  22. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotojs.py +0 -0
  23. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotojsons.py +0 -0
  24. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotojstruct.py +0 -0
  25. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotokusto.py +0 -0
  26. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotomd.py +0 -0
  27. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotools.py +0 -0
  28. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotoparquet.py +0 -0
  29. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotoproto.py +0 -0
  30. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotopython.py +0 -0
  31. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotorust.py +0 -0
  32. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotots.py +0 -0
  33. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrotoxsd.py +0 -0
  34. {structurize-3.5.4 → structurize-3.5.5}/avrotize/avrovalidator.py +0 -0
  35. {structurize-3.5.4 → structurize-3.5.5}/avrotize/cddltostructure.py +0 -0
  36. {structurize-3.5.4 → structurize-3.5.5}/avrotize/choice_inference.py +0 -0
  37. {structurize-3.5.4 → structurize-3.5.5}/avrotize/commands.json +0 -0
  38. {structurize-3.5.4 → structurize-3.5.5}/avrotize/common.py +0 -0
  39. {structurize-3.5.4 → structurize-3.5.5}/avrotize/constants.py +0 -0
  40. {structurize-3.5.4 → structurize-3.5.5}/avrotize/csvtoavro.py +0 -0
  41. {structurize-3.5.4 → structurize-3.5.5}/avrotize/datapackagetoavro.py +0 -0
  42. {structurize-3.5.4 → structurize-3.5.5}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
  43. {structurize-3.5.4 → structurize-3.5.5}/avrotize/dependencies/typescript/node22/package.json +0 -0
  44. {structurize-3.5.4 → structurize-3.5.5}/avrotize/dependency_resolver.py +0 -0
  45. {structurize-3.5.4 → structurize-3.5.5}/avrotize/dependency_version.py +0 -0
  46. {structurize-3.5.4 → structurize-3.5.5}/avrotize/jsonstoavro.py +0 -0
  47. {structurize-3.5.4 → structurize-3.5.5}/avrotize/jsonstostructure.py +0 -0
  48. {structurize-3.5.4 → structurize-3.5.5}/avrotize/jsontoschema.py +0 -0
  49. {structurize-3.5.4 → structurize-3.5.5}/avrotize/jstructtoavro.py +0 -0
  50. {structurize-3.5.4 → structurize-3.5.5}/avrotize/kstructtoavro.py +0 -0
  51. {structurize-3.5.4 → structurize-3.5.5}/avrotize/kustotoavro.py +0 -0
  52. {structurize-3.5.4 → structurize-3.5.5}/avrotize/kustotojstruct.py +0 -0
  53. {structurize-3.5.4 → structurize-3.5.5}/avrotize/mcp_server.py +0 -0
  54. {structurize-3.5.4 → structurize-3.5.5}/avrotize/openapitostructure.py +0 -0
  55. {structurize-3.5.4 → structurize-3.5.5}/avrotize/parquettoavro.py +0 -0
  56. {structurize-3.5.4 → structurize-3.5.5}/avrotize/proto2parser.py +0 -0
  57. {structurize-3.5.4 → structurize-3.5.5}/avrotize/proto3parser.py +0 -0
  58. {structurize-3.5.4 → structurize-3.5.5}/avrotize/prototoavro.py +0 -0
  59. {structurize-3.5.4 → structurize-3.5.5}/avrotize/schema_inference.py +0 -0
  60. {structurize-3.5.4 → structurize-3.5.5}/avrotize/sqltoavro.py +0 -0
  61. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretocddl.py +0 -0
  62. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretocpp.py +0 -0
  63. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretocsharp.py +0 -0
  64. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretocsv.py +0 -0
  65. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretodatapackage.py +0 -0
  66. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretodb.py +0 -0
  67. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretogo.py +0 -0
  68. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretographql.py +0 -0
  69. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretoiceberg.py +0 -0
  70. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretojava.py +0 -0
  71. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretojs.py +0 -0
  72. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretojsons.py +0 -0
  73. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretokusto.py +0 -0
  74. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretomd.py +0 -0
  75. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretoproto.py +0 -0
  76. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretorust.py +0 -0
  77. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretots.py +0 -0
  78. {structurize-3.5.4 → structurize-3.5.5}/avrotize/structuretoxsd.py +0 -0
  79. {structurize-3.5.4 → structurize-3.5.5}/avrotize/validate.py +0 -0
  80. {structurize-3.5.4 → structurize-3.5.5}/avrotize/xmltoschema.py +0 -0
  81. {structurize-3.5.4 → structurize-3.5.5}/avrotize/xsdtoavro.py +0 -0
  82. {structurize-3.5.4 → structurize-3.5.5}/build.ps1 +0 -0
  83. {structurize-3.5.4 → structurize-3.5.5}/build.sh +0 -0
  84. {structurize-3.5.4 → structurize-3.5.5}/pyproject.toml +0 -0
  85. {structurize-3.5.4 → structurize-3.5.5}/setup.cfg +0 -0
  86. {structurize-3.5.4 → structurize-3.5.5}/structurize.egg-info/SOURCES.txt +0 -0
  87. {structurize-3.5.4 → structurize-3.5.5}/structurize.egg-info/dependency_links.txt +0 -0
  88. {structurize-3.5.4 → structurize-3.5.5}/structurize.egg-info/entry_points.txt +0 -0
  89. {structurize-3.5.4 → structurize-3.5.5}/structurize.egg-info/requires.txt +0 -0
  90. {structurize-3.5.4 → structurize-3.5.5}/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.5.4
3
+ Version: 3.5.5
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
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '3.5.4'
22
- __version_tuple__ = version_tuple = (3, 5, 4)
21
+ __version__ = version = '3.5.5'
22
+ __version_tuple__ = version_tuple = (3, 5, 5)
23
23
 
24
- __commit_id__ = commit_id = 'g783dbb9df'
24
+ __commit_id__ = commit_id = 'g2c742c4cc'
@@ -812,6 +812,32 @@ class StructureToPython:
812
812
  with open(os.path.join(self.output_dir, 'pyproject.toml'), 'w', encoding='utf-8') as file:
813
813
  file.write(pyproject_content)
814
814
 
815
+ def process_definitions(self, definitions: Dict, namespace_path: str) -> None:
816
+ """ Recursively walks the definitions tree and generates a Python type for each leaf.
817
+
818
+ Leaves are sub-schemas that carry an ``enum`` keyword or a ``type`` of
819
+ ``object``/``choice``/``map``. Other dict entries are treated as nested
820
+ namespace segments (matching the path-as-namespace convention used in
821
+ ``$root`` JSON pointers like ``#/definitions/de/wsv/pegelonline/Station``).
822
+ """
823
+ for name, definition in definitions.items():
824
+ if not isinstance(definition, dict):
825
+ continue
826
+ if 'enum' in definition:
827
+ self.generate_enum(definition, name, namespace_path, write_file=True)
828
+ elif definition.get('type') == 'object':
829
+ self.generate_class(definition, namespace_path, write_file=True, explicit_name=name)
830
+ elif definition.get('type') == 'choice':
831
+ self.generate_choice(definition, namespace_path, write_file=True, explicit_name=name)
832
+ elif definition.get('type') == 'map':
833
+ # generate_map_alias doesn't accept explicit_name; stamp the name on a copy.
834
+ map_schema = dict(definition)
835
+ map_schema.setdefault('name', name)
836
+ self.generate_map_alias(map_schema, namespace_path, write_file=True)
837
+ else:
838
+ new_namespace = f"{namespace_path}.{name}" if namespace_path else name
839
+ self.process_definitions(definition, new_namespace)
840
+
815
841
  def convert_schemas(self, structure_schemas: List, output_dir: str):
816
842
  """ Converts JSON Structure schemas to Python dataclasses"""
817
843
  self.output_dir = output_dir
@@ -827,15 +853,48 @@ class StructureToPython:
827
853
  if 'definitions' in structure_schema:
828
854
  self.definitions = structure_schema['definitions']
829
855
 
856
+ handled = False
830
857
  if 'enum' in structure_schema:
831
- self.generate_enum(structure_schema, structure_schema.get('name', 'Enum'),
858
+ self.generate_enum(structure_schema, structure_schema.get('name', 'Enum'),
832
859
  structure_schema.get('namespace', ''), write_file=True)
860
+ handled = True
833
861
  elif structure_schema.get('type') == 'object':
834
862
  self.generate_class(structure_schema, structure_schema.get('namespace', ''), write_file=True)
863
+ handled = True
835
864
  elif structure_schema.get('type') == 'choice':
836
865
  self.generate_choice(structure_schema, structure_schema.get('namespace', ''), write_file=True)
866
+ handled = True
837
867
  elif structure_schema.get('type') == 'map':
838
868
  self.generate_map_alias(structure_schema, structure_schema.get('namespace', ''), write_file=True)
869
+ handled = True
870
+ elif '$root' in structure_schema:
871
+ # $root + definitions wrapper: resolve the pointer, derive the namespace
872
+ # from the pointer path (segments between 'definitions' and the type name),
873
+ # and emit the targeted class explicitly. Sibling types in `definitions`
874
+ # are picked up below by process_definitions.
875
+ root_ref = structure_schema['$root']
876
+ root_schema = self.resolve_ref(root_ref, structure_schema)
877
+ if root_schema:
878
+ ref_path = root_ref.split('/')
879
+ type_name = ref_path[-1]
880
+ ref_namespace = '.'.join(ref_path[2:-1]) if len(ref_path) > 3 else ''
881
+ self.generate_class_or_choice(root_schema, ref_namespace, write_file=True, explicit_name=type_name)
882
+ handled = True
883
+
884
+ # Recursively walk the definitions tree so every named type is emitted,
885
+ # regardless of whether the top-level schema also dispatched something.
886
+ if 'definitions' in structure_schema:
887
+ self.process_definitions(structure_schema['definitions'], '')
888
+ handled = True
889
+
890
+ if not handled:
891
+ schema_id = structure_schema.get('$id', '<no $id>')
892
+ schema_name = structure_schema.get('name', '<no name>')
893
+ print(
894
+ f"Warning: structure schema (id={schema_id}, name={schema_name}) did not "
895
+ "match any recognized top-level shape (enum, type=object/choice/map, "
896
+ "$root, or definitions); no Python output generated for it."
897
+ )
839
898
 
840
899
  self.write_init_files()
841
900
  self.write_pyproject_toml()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structurize
3
- Version: 3.5.4
3
+ Version: 3.5.5
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