Skip to content

Commit fc264ab

Browse files
feat: update json schema
The schema definition json changed due to [changes in `schemars`](GREsau/schemars#417) The generated python code is unchanged due to this particular schema change, except `desc` property has been added, because it was forgotten on previous changes in pangraph. I also fixed incorrect filename in the readme.
1 parent cb59965 commit fc264ab

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

packages/pangraph-schemas/Pangraph.schema.json

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "_PangraphSchemaRoot",
4-
"description": "AUTOGENERATED! This JSON schema file is generated automatically from Rust types.\n The root object definition is a dummy container for the types being exposed. Disregard\n it. Instead, see the actual types in the `definitions` property of that container.",
4+
"description": "AUTOGENERATED! This JSON schema file is generated automatically from Rust types.\nThe root object definition is a dummy container for the types being exposed. Disregard\nit. Instead, see the actual types in the `definitions` property of that container.",
55
"type": "object",
66
"properties": {
77
"pangraph": {
@@ -17,21 +17,30 @@
1717
"properties": {
1818
"paths": {
1919
"type": "object",
20-
"additionalProperties": {
21-
"$ref": "#/$defs/PangraphPath"
22-
}
20+
"patternProperties": {
21+
"^\\d+$": {
22+
"$ref": "#/$defs/PangraphPath"
23+
}
24+
},
25+
"additionalProperties": false
2326
},
2427
"blocks": {
2528
"type": "object",
26-
"additionalProperties": {
27-
"$ref": "#/$defs/PangraphBlock"
28-
}
29+
"patternProperties": {
30+
"^\\d+$": {
31+
"$ref": "#/$defs/PangraphBlock"
32+
}
33+
},
34+
"additionalProperties": false
2935
},
3036
"nodes": {
3137
"type": "object",
32-
"additionalProperties": {
33-
"$ref": "#/$defs/PangraphNode"
34-
}
38+
"patternProperties": {
39+
"^\\d+$": {
40+
"$ref": "#/$defs/PangraphNode"
41+
}
42+
},
43+
"additionalProperties": false
3544
}
3645
},
3746
"required": [
@@ -101,9 +110,12 @@
101110
},
102111
"alignments": {
103112
"type": "object",
104-
"additionalProperties": {
105-
"$ref": "#/$defs/Edit"
106-
}
113+
"patternProperties": {
114+
"^\\d+$": {
115+
"$ref": "#/$defs/Edit"
116+
}
117+
},
118+
"additionalProperties": false
107119
}
108120
},
109121
"required": [

packages/pangraph-schemas/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cd pangraph-schemas/
2626
pip3 install dacite datamodel-code-generator pydantic
2727

2828
# Generate Python classes
29-
datamodel-codegen --input-file-type "jsonschema" --input "Pangraph.schema.json" --output-model-type "dataclasses.dataclass" --enum-field-as-literal=all --output "python/Pangraph.py"
29+
datamodel-codegen --input-file-type "jsonschema" --input "Pangraph.schema.json" --output-model-type "dataclasses.dataclass" --enum-field-as-literal=all --output "python/Pangraph_model.py"
3030

3131
# Run the example using the generated Python classes
3232
python3 python/example.py path/to/your/pangraph/output.json

packages/pangraph-schemas/python/Pangraph_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: Pangraph.schema.json
3-
# timestamp: 2024-10-23T22:10:52+00:00
3+
# timestamp: 2025-09-20T00:33:52+00:00
44

55
from __future__ import annotations
66

@@ -44,6 +44,7 @@ class PangraphPath:
4444
tot_len: int
4545
circular: bool
4646
name: Optional[str] = None
47+
desc: Optional[str] = None
4748

4849

4950
@dataclass

0 commit comments

Comments
 (0)