{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://hwlab.pikastech.local/protocol/schemas/json-rpc-envelope.schema.json", "title": "HWLAB JSON-RPC Envelope", "oneOf": [ { "type": "object", "required": ["jsonrpc", "id", "method", "meta"], "properties": { "jsonrpc": { "const": "2.0" }, "id": { "type": ["string", "number"] }, "method": { "type": "string", "pattern": "^[a-z][a-z0-9]*(\\.[a-z][a-z0-9_]*)+$" }, "params": { "type": "object", "additionalProperties": true }, "meta": { "$ref": "#/$defs/meta" } }, "additionalProperties": false }, { "type": "object", "required": ["jsonrpc", "id", "result", "meta"], "properties": { "jsonrpc": { "const": "2.0" }, "id": { "type": ["string", "number"] }, "result": true, "meta": { "$ref": "#/$defs/meta" } }, "not": { "required": ["error"] }, "additionalProperties": false }, { "type": "object", "required": ["jsonrpc", "id", "error", "meta"], "properties": { "jsonrpc": { "const": "2.0" }, "id": { "type": ["string", "number", "null"] }, "error": { "type": "object", "required": ["code", "message"], "properties": { "code": { "type": "integer" }, "message": { "type": "string", "minLength": 1 }, "data": true }, "additionalProperties": false }, "meta": { "$ref": "#/$defs/meta" } }, "not": { "required": ["result"] }, "additionalProperties": false } ], "$defs": { "meta": { "type": "object", "required": ["traceId", "serviceId", "environment"], "properties": { "traceId": { "$ref": "common.json#/$defs/id" }, "actorId": { "$ref": "common.json#/$defs/id" }, "serviceId": { "$ref": "common.json#/$defs/serviceId" }, "environment": { "$ref": "common.json#/$defs/environment" } }, "additionalProperties": true } } }