structurize 3.5.3__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.
- {structurize-3.5.3/structurize.egg-info → structurize-3.5.5}/PKG-INFO +1 -1
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/_version.py +3 -3
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/kustotojstruct.py +119 -27
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretopython.py +60 -1
- {structurize-3.5.3 → structurize-3.5.5/structurize.egg-info}/PKG-INFO +1 -1
- {structurize-3.5.3 → structurize-3.5.5}/.gitignore +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/LICENSE +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/MANIFEST.in +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/README.md +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/__init__.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/__main__.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/asn1toavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotize.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotocpp.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotocsharp.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotocsv.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotodatapackage.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotodb.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotogo.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotographql.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotoiceberg.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotojava.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotojs.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotojsons.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotojstruct.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotokusto.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotomd.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotools.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotoparquet.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotoproto.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotopython.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotorust.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotots.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrotoxsd.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/avrovalidator.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/cddltostructure.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/choice_inference.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/commands.json +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/common.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/constants.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/csvtoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/datapackagetoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/dependencies/typescript/node22/package.json +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/dependency_resolver.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/dependency_version.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/jsonstoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/jsonstostructure.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/jsontoschema.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/jstructtoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/kstructtoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/kustotoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/mcp_server.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/openapitostructure.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/parquettoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/proto2parser.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/proto3parser.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/prototoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/schema_inference.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/sqltoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretocddl.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretocpp.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretocsharp.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretocsv.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretodatapackage.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretodb.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretogo.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretographql.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretoiceberg.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretojava.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretojs.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretojsons.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretokusto.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretomd.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretoproto.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretorust.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretots.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/structuretoxsd.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/validate.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/xmltoschema.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/avrotize/xsdtoavro.py +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/build.ps1 +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/build.sh +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/pyproject.toml +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/setup.cfg +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/structurize.egg-info/SOURCES.txt +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/structurize.egg-info/dependency_links.txt +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/structurize.egg-info/entry_points.txt +0 -0
- {structurize-3.5.3 → structurize-3.5.5}/structurize.egg-info/requires.txt +0 -0
- {structurize-3.5.3 → 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.
|
|
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.
|
|
22
|
-
__version_tuple__ = version_tuple = (3, 5,
|
|
21
|
+
__version__ = version = '3.5.5'
|
|
22
|
+
__version_tuple__ = version_tuple = (3, 5, 5)
|
|
23
23
|
|
|
24
|
-
__commit_id__ = commit_id = '
|
|
24
|
+
__commit_id__ = commit_id = 'g2c742c4cc'
|
|
@@ -85,7 +85,11 @@ class KustoToJsonStructure:
|
|
|
85
85
|
return self.type_map.get(kusto_type, "string")
|
|
86
86
|
|
|
87
87
|
def kusto_to_jstruct_schema(self, kusto_schema: dict, table_name: str) -> JsonNode:
|
|
88
|
-
""" Converts a Kusto schema to JSON Structure schema.
|
|
88
|
+
""" Converts a Kusto schema to JSON Structure schema.
|
|
89
|
+
|
|
90
|
+
Returns a list of tuples (type_value, schema) where type_value is the CloudEvents
|
|
91
|
+
type value (or None for non-CloudEvents tables).
|
|
92
|
+
"""
|
|
89
93
|
column_names = set([column['Name'].lstrip('_')
|
|
90
94
|
for column in kusto_schema['OrderedColumns']])
|
|
91
95
|
type_values: List[str|None] = []
|
|
@@ -105,7 +109,7 @@ class KustoToJsonStructure:
|
|
|
105
109
|
if len(type_values) == 0:
|
|
106
110
|
type_values.append(None)
|
|
107
111
|
|
|
108
|
-
schemas: List[
|
|
112
|
+
schemas: List[tuple] = []
|
|
109
113
|
for type_value in type_values:
|
|
110
114
|
schema: JsonNode = {}
|
|
111
115
|
properties: Dict[str, JsonNode] = {}
|
|
@@ -120,10 +124,11 @@ class KustoToJsonStructure:
|
|
|
120
124
|
data_schemas = [data_schemas]
|
|
121
125
|
if isinstance(data_schemas, list):
|
|
122
126
|
for schema in data_schemas:
|
|
123
|
-
if
|
|
124
|
-
|
|
127
|
+
if isinstance(schema, dict):
|
|
128
|
+
# Remove inferrer artifacts that don't belong in the final schema
|
|
129
|
+
schema.pop("root", None)
|
|
125
130
|
self.apply_schema_attributes(schema, kusto_schema, table_name, type_value)
|
|
126
|
-
schemas.append(schema)
|
|
131
|
+
schemas.append((type_value, schema))
|
|
127
132
|
else:
|
|
128
133
|
for column in kusto_schema['OrderedColumns']:
|
|
129
134
|
jstruct_type = self.map_kusto_type_to_jstruct_type(
|
|
@@ -147,9 +152,9 @@ class KustoToJsonStructure:
|
|
|
147
152
|
"properties": properties
|
|
148
153
|
}
|
|
149
154
|
self.apply_schema_attributes(schema, kusto_schema, table_name, type_value)
|
|
150
|
-
schemas.append(schema)
|
|
155
|
+
schemas.append((type_value, schema))
|
|
151
156
|
|
|
152
|
-
return schemas
|
|
157
|
+
return schemas
|
|
153
158
|
|
|
154
159
|
|
|
155
160
|
def wrap_schema_in_root_record(self, schema: JsonNode, type_name: str):
|
|
@@ -188,6 +193,16 @@ class KustoToJsonStructure:
|
|
|
188
193
|
table_names = [row['TableName'] for row in rows.primary_results[0]]
|
|
189
194
|
return table_names
|
|
190
195
|
|
|
196
|
+
def _derive_schema_id(self, type_value: str | None, table_name: str) -> str:
|
|
197
|
+
"""Derives a schema ID from the event type value or table name."""
|
|
198
|
+
if type_value:
|
|
199
|
+
return type_value
|
|
200
|
+
return table_name
|
|
201
|
+
|
|
202
|
+
def _derive_group_id(self, table_name: str) -> str:
|
|
203
|
+
"""Derives a message group ID from the table name."""
|
|
204
|
+
return table_name
|
|
205
|
+
|
|
191
206
|
def process_all_tables(self):
|
|
192
207
|
""" Processes all tables in the Kusto database."""
|
|
193
208
|
if self.single_table_name:
|
|
@@ -195,15 +210,13 @@ class KustoToJsonStructure:
|
|
|
195
210
|
else:
|
|
196
211
|
table_names = self.fetch_all_table_names()
|
|
197
212
|
|
|
198
|
-
|
|
213
|
+
# Collect all (type_value, schema) tuples grouped by table
|
|
214
|
+
all_entries: List[tuple] = []
|
|
199
215
|
for table_name in table_names:
|
|
200
216
|
kusto_schema = self.fetch_table_schema_and_docs(table_name)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
all_schemas.extend(jstruct_schema)
|
|
205
|
-
else:
|
|
206
|
-
all_schemas.append(jstruct_schema)
|
|
217
|
+
entries = self.kusto_to_jstruct_schema(kusto_schema, table_name)
|
|
218
|
+
for entry in entries:
|
|
219
|
+
all_entries.append((table_name, entry[0], entry[1]))
|
|
207
220
|
|
|
208
221
|
# Write output
|
|
209
222
|
output_dir = os.path.dirname(self.jstruct_schema_path)
|
|
@@ -211,26 +224,105 @@ class KustoToJsonStructure:
|
|
|
211
224
|
os.makedirs(output_dir)
|
|
212
225
|
|
|
213
226
|
if self.emit_xregistry:
|
|
214
|
-
|
|
215
|
-
output = {
|
|
216
|
-
"$schema": "https://cloudevents.io/schemas/registry",
|
|
217
|
-
"specversion": "0.5-wip",
|
|
218
|
-
"endpoints": {},
|
|
219
|
-
"messagegroups": {},
|
|
220
|
-
"schemagroups": {
|
|
221
|
-
f"{self.kusto_database}": {
|
|
222
|
-
"schemas": {schema.get("$id", f"schema_{i}"): {"format": "JSONStructure/1.0", "schema": schema}
|
|
223
|
-
for i, schema in enumerate(all_schemas)}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
+
output = self._build_xregistry_manifest(all_entries)
|
|
227
228
|
else:
|
|
228
229
|
# Single schema or array of schemas
|
|
230
|
+
all_schemas = [entry[2] for entry in all_entries]
|
|
229
231
|
output = all_schemas if len(all_schemas) > 1 else all_schemas[0] if all_schemas else {}
|
|
230
232
|
|
|
231
233
|
with open(self.jstruct_schema_path, 'w', encoding='utf-8') as jstruct_file:
|
|
232
234
|
json.dump(output, jstruct_file, indent=4)
|
|
233
235
|
|
|
236
|
+
def _build_xregistry_manifest(self, all_entries: List[tuple]) -> dict:
|
|
237
|
+
"""Builds an xRegistry manifest with messagegroups and schemagroups.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
all_entries: List of (table_name, type_value, schema) tuples.
|
|
241
|
+
"""
|
|
242
|
+
messagegroups: Dict[str, JsonNode] = {}
|
|
243
|
+
schemagroups: Dict[str, JsonNode] = {}
|
|
244
|
+
|
|
245
|
+
# Group entries by table
|
|
246
|
+
tables: Dict[str, List[tuple]] = {}
|
|
247
|
+
for table_name, type_value, schema in all_entries:
|
|
248
|
+
if table_name not in tables:
|
|
249
|
+
tables[table_name] = []
|
|
250
|
+
tables[table_name].append((type_value, schema))
|
|
251
|
+
|
|
252
|
+
for table_name, entries in tables.items():
|
|
253
|
+
group_id = self._derive_group_id(table_name)
|
|
254
|
+
has_cloudevents = any(tv is not None for tv, _ in entries)
|
|
255
|
+
|
|
256
|
+
# Build schema group
|
|
257
|
+
schemas: Dict[str, JsonNode] = {}
|
|
258
|
+
for type_value, schema in entries:
|
|
259
|
+
schema_id = self._derive_schema_id(type_value, table_name)
|
|
260
|
+
schemas[schema_id] = {
|
|
261
|
+
"format": "JSONStructure/1.0",
|
|
262
|
+
"versions": {
|
|
263
|
+
"1": {
|
|
264
|
+
"format": "JSONStructure/1.0",
|
|
265
|
+
"schema": schema
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
schemagroups[group_id] = {"schemas": schemas}
|
|
270
|
+
|
|
271
|
+
if has_cloudevents:
|
|
272
|
+
# Build message group with CloudEvents messages
|
|
273
|
+
messages: Dict[str, JsonNode] = {}
|
|
274
|
+
for type_value, schema in entries:
|
|
275
|
+
if type_value is None:
|
|
276
|
+
continue
|
|
277
|
+
schema_id = self._derive_schema_id(type_value, table_name)
|
|
278
|
+
messages[type_value] = {
|
|
279
|
+
"description": f"CloudEvent of type {type_value}",
|
|
280
|
+
"envelope": "CloudEvents/1.0",
|
|
281
|
+
"envelopemetadata": {
|
|
282
|
+
"id": {
|
|
283
|
+
"required": True
|
|
284
|
+
},
|
|
285
|
+
"type": {
|
|
286
|
+
"value": type_value
|
|
287
|
+
},
|
|
288
|
+
"source": {
|
|
289
|
+
"required": True
|
|
290
|
+
},
|
|
291
|
+
"time": {
|
|
292
|
+
"required": True
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"datacontenttype": "application/json",
|
|
296
|
+
"dataschemaformat": "JSONStructure/1.0",
|
|
297
|
+
"dataschemauri": f"#/schemagroups/{group_id}/schemas/{schema_id}"
|
|
298
|
+
}
|
|
299
|
+
messagegroups[group_id] = {
|
|
300
|
+
"envelope": "CloudEvents/1.0",
|
|
301
|
+
"description": f"Events from {table_name}",
|
|
302
|
+
"messages": messages
|
|
303
|
+
}
|
|
304
|
+
else:
|
|
305
|
+
# Non-CloudEvents table: add a simple message group entry
|
|
306
|
+
messages = {}
|
|
307
|
+
for type_value, schema in entries:
|
|
308
|
+
schema_id = self._derive_schema_id(type_value, table_name)
|
|
309
|
+
messages[schema_id] = {
|
|
310
|
+
"description": f"Message from {table_name}",
|
|
311
|
+
"dataschemaformat": "JSONStructure/1.0",
|
|
312
|
+
"dataschemauri": f"#/schemagroups/{group_id}/schemas/{schema_id}"
|
|
313
|
+
}
|
|
314
|
+
messagegroups[group_id] = {
|
|
315
|
+
"description": f"Messages from {table_name}",
|
|
316
|
+
"messages": messages
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return {
|
|
320
|
+
"$schema": "https://cloudevents.io/schemas/registry",
|
|
321
|
+
"specversion": "0.5-wip",
|
|
322
|
+
"messagegroups": messagegroups,
|
|
323
|
+
"schemagroups": schemagroups
|
|
324
|
+
}
|
|
325
|
+
|
|
234
326
|
|
|
235
327
|
def convert_kusto_to_jstruct(kusto_uri: str, kusto_database: str, table_name: str | None, base_id: str, jstruct_schema_file: str, emit_cloudevents: bool, emit_cloudevents_xregistry: bool, token_provider=None, sample_size: int = 100, infer_choices: bool = False, choice_depth: int = 1, infer_enums: bool = False):
|
|
236
328
|
""" Converts Kusto table schemas to JSON Structure schema format."""
|
|
@@ -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.
|
|
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
|
|
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-3.5.3 → structurize-3.5.5}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|