Files
specs/openspec/changes/archive/2026-10-09-reconcile-hourly-investment-sync/system-analysis/contracts/investment-resource-envelope.schema.json
T
ksv741 329d66e767
Specs security / security (push) Successful in 8s
Specs verify / verify (push) Successful in 11s
spec: finalize wealth-ledger SDD migration
2026-10-09 21:14:22 +03:00

55 lines
2.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "reconcile-hourly-investment-sync/investment-resource-envelope.schema.json",
"title": "Target investment resource envelope",
"description": "Target cross-system semantics only; the backend-generated OpenAPI remains the executable HTTP contract.",
"type": "object",
"required": ["data", "meta"],
"properties": {
"data": {
"description": "The last confirmed complete result, an allowed incomplete ledger first-load result, or null when no complete result is available."
},
"meta": { "$ref": "#/$defs/resourceMeta" },
"sync": { "$ref": "#/$defs/hourlyWalk" }
},
"$defs": {
"resourceMeta": {
"type": "object",
"required": ["freshness", "completeness", "lastSuccessfulAt", "lastAttempt", "availability"],
"properties": {
"freshness": { "enum": ["fresh", "stale", "unknown"] },
"completeness": { "enum": ["complete", "incomplete"] },
"lastSuccessfulAt": { "type": ["string", "null"], "format": "date-time" },
"lastAttempt": { "$ref": "#/$defs/attempt" },
"availability": { "enum": ["available", "initial-loading", "temporarily-unavailable", "connection-unavailable"] }
}
},
"attempt": {
"type": "object",
"required": ["state", "startedAt", "finishedAt", "problems"],
"properties": {
"state": { "enum": ["none", "running", "succeeded", "partial", "failed"] },
"startedAt": { "type": ["string", "null"], "format": "date-time" },
"finishedAt": { "type": ["string", "null"], "format": "date-time" },
"problems": { "type": "array", "items": { "$ref": "#/$defs/problemSection" } }
}
},
"hourlyWalk": {
"description": "Present only on Accounts; absent from other resource envelopes.",
"oneOf": [
{ "type": "null" },
{ "$ref": "#/$defs/attempt" }
]
},
"problemSection": {
"type": "object",
"required": ["section", "accountId", "errorCode"],
"properties": {
"section": { "enum": ["membership", "portfolio", "operations", "events"] },
"accountId": { "type": ["string", "null"] },
"errorCode": { "type": ["string", "null"] }
}
}
}
}