Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 128 additions & 63 deletions pmoves/contracts/schemas/geometry/cgp.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"spec",
"super_nodes"
],
"additionalProperties": true,
"properties": {
"spec": {
"type": "string",
Expand All @@ -15,7 +16,11 @@
"type": "string"
},
"meta": {
"type": "object"
"type": [
"object",
"null"
],
"additionalProperties": true
},
Comment on lines 18 to 24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep CGP meta non-null or relax API model

The schema now allows meta to be null and adds additionalProperties at the root, but the gateway still validates requests with CGP.meta: Dict[str, Any] (see gateway/api/chit.py). Any client using the schema to validate and sending "meta": null will pass schema validation but FastAPI/Pydantic rejects the payload with a 422 because the field is not optional. Either revert the schema to require an object or update the API model to accept None to keep the contract consistent.

Useful? React with 👍 / 👎.

"created_at": {
"type": "string",
Expand All @@ -27,40 +32,9 @@
},
"super_nodes": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"constellations"
],
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"summary": {
"type": "string"
},
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"r": {
"type": "number"
},
"meta": {
"type": "object"
},
"constellations": {
"type": "array",
"items": {
"$ref": "#/$defs/constellation"
}
}
}
"$ref": "#/$defs/super_node"
}
},
"constellations": {
Expand All @@ -78,24 +52,65 @@
"sig": {
"oneOf": [
{
"type": "string"
"type": "null"
},
{
"type": "object"
"type": "string"
},
{
"type": "null"
"$ref": "#/$defs/signature"
}
]
}
},
"$defs": {
"super_node": {
"type": "object",
"required": [
"constellations"
],
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"summary": {
"type": "string"
},
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"r": {
"type": "number"
},
"meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"constellations": {
"type": "array",
"items": {
"$ref": "#/$defs/constellation"
}
}
}
},
"constellation": {
"type": "object",
"required": [
"id",
"points"
],
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
Expand All @@ -116,30 +131,7 @@
"type": "null"
},
{
"type": "object",
"properties": {
"alg": {
"type": "string"
},
"iv": {
"type": "string"
},
"salt": {
"type": "string"
},
"ct": {
"type": "string"
},
"tag": {
"type": "string"
}
},
"required": [
"alg",
"iv",
"salt",
"ct"
]
"$ref": "#/$defs/encrypted_anchor"
}
]
},
Expand Down Expand Up @@ -168,7 +160,11 @@
}
},
"meta": {
"type": "object"
"type": [
"object",
"null"
],
"additionalProperties": true
},
"created_at": {
"type": "string",
Expand All @@ -185,16 +181,23 @@
"required": [
"id"
],
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
},
"modality": {
"type": "string"
},
"mod": {
"type": "string"
},
"ref_id": {
"type": "string"
},
"source_ref": {
"type": "string"
},
"video_id": {
"type": "string"
},
Expand Down Expand Up @@ -255,7 +258,69 @@
"type": "string"
},
"meta": {
"type": "object"
"type": [
"object",
"null"
],
"additionalProperties": true
}
}
},
"encrypted_anchor": {
"type": "object",
"additionalProperties": false,
"properties": {
"alg": {
"type": "string"
},
"iv": {
"type": "string"
},
"salt": {
"type": "string"
},
"ct": {
"type": "string"
},
"tag": {
"type": "string"
}
},
"required": [
"iv",
"salt",
"ct"
]
},
"signature": {
"type": "object",
"additionalProperties": true,
"required": [
"alg",
"hmac"
],
"properties": {
"alg": {
"type": "string"
},
"kid": {
"type": "string"
},
"ts": {
"type": [
"integer",
"string"
]
},
"hmac": {
"type": "string"
},
"meta": {
"type": [
"object",
"null"
],
"additionalProperties": true
}
}
}
Expand Down
Loading