Skip to content

Commit 3d55c54

Browse files
authored
Refactor receipt schema description and properties
1 parent 7de96e3 commit 3d55c54

File tree

1 file changed

+28
-49
lines changed

1 file changed

+28
-49
lines changed

schemas/v1.0.0/commercial/verify/receipts/verify.receipt.schema.json

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,49 @@
22
"$id": "https://commandlayer.org/schemas/v1.0.0/commercial/verify/receipts/verify.receipt.schema.json",
33
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"title": "verify.receipt",
5-
"description": "Receipt schema for commercial verification of a payment, invoice, or settlement against a provider’s canonical view.",
5+
"description": "Receipt for commercial verification; echoes provider’s canonical view.",
66
"allOf": [
7-
{
8-
"$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/receipt.base.schema.json"
9-
},
7+
{ "$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/receipt.base.schema.json" },
108
{
119
"type": "object",
1210
"properties": {
1311
"result": {
14-
"description": "Verification outcome payload.",
1512
"type": "object",
1613
"additionalProperties": false,
17-
"required": ["target", "verified", "status"],
14+
"required": ["target","verified","status"],
1815
"properties": {
19-
"target": {
20-
"description": "The identifier that was verified (transaction ID, invoice ID, payout ID, etc.).",
21-
"type": "string",
22-
"minLength": 1,
23-
"maxLength": 256
24-
},
25-
"verified": {
26-
"description": "Whether the provider’s canonical record matches the caller’s expectations.",
27-
"type": "boolean"
28-
},
29-
"status": {
30-
"description": "Provider’s canonical status for this object.",
31-
"type": "string",
32-
"enum": ["success", "pending", "failed", "not_found"]
33-
},
34-
"amount": {
35-
"description": "Canonical amount/asset as seen by the provider.",
36-
"allOf": [
37-
{
38-
"$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.amount.schema.json"
39-
}
40-
]
41-
},
42-
"settlement": {
43-
"description": "Canonical settlement destination as seen by the provider.",
44-
"allOf": [
45-
{
46-
"$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.settlement.schema.json"
47-
}
48-
]
49-
},
50-
"reason": {
51-
"description": "Optional explanation when verified = false or status != 'success'.",
52-
"type": "string",
53-
"maxLength": 1024
16+
"target": { "type": "string", "minLength": 1, "maxLength": 256 },
17+
"verified": { "type": "boolean" },
18+
"status": { "type": "string", "enum": ["success","pending","failed","not_found"] },
19+
"amount": { "allOf": [{ "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.amount.schema.json" }] },
20+
"settlement": { "allOf": [{ "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.settlement.schema.json" }] },
21+
"evidence": {
22+
"type": "object",
23+
"additionalProperties": false,
24+
"properties": {
25+
"tx_hash": { "type": "string", "pattern": "^0x[a-fA-F0-9]{64}$" },
26+
"block_number": { "type": "integer", "minimum": 0 },
27+
"log_index": { "type": "integer", "minimum": 0 },
28+
"provider_ref": { "type": "string", "maxLength": 256 }
29+
}
5430
},
31+
"reason": { "type": "string", "maxLength": 1024 },
5532
"metadata": {
56-
"description": "Optional provider- or runtime-specific additional context.",
5733
"type": "object",
58-
"additionalProperties": true
34+
"additionalProperties": true,
35+
"maxProperties": 100,
36+
"propertyNames": { "type": "string", "maxLength": 64 }
5937
}
6038
}
61-
},
62-
"usage": {
63-
"description": "Optional resource usage metrics (tokens, compute units, etc.).",
64-
"type": "object",
65-
"additionalProperties": true
6639
}
6740
},
68-
"required": ["result"]
41+
"required": ["result"],
42+
"allOf": [
43+
{ "if": { "properties": { "status": { "const": "success" } }, "required": ["status"] }, "then": { "required": ["result"] } },
44+
{ "if": { "properties": { "status": { "const": "error" } }, "required": ["status"] }, "then": { "required": ["error"], "properties": { "result": false } } },
45+
{ "if": { "properties": { "result": { "properties": { "status": { "const": "not_found" } } } } }, "then": { "properties": { "result": { "properties": { "verified": { "const": false } } } } } },
46+
{ "if": { "properties": { "result": { "properties": { "verified": { "const": false } } } } }, "then": { "properties": { "result": { "required": ["reason"] } } } }
47+
]
6948
}
7049
]
7150
}

0 commit comments

Comments
 (0)