{ "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "type": { "type": "string", "const": "game.command" }, "commandId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "expected": { "$ref": "#/$defs/__schema2" }, "action": { "$ref": "#/$defs/__schema4" } }, "required": [ "protocolVersion", "matchId", "type", "commandId", "expected", "action" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "type": { "type": "string", "const": "game.snapshot" }, "subscriptionId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "delivery": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "sync" }, "requestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": ["kind", "requestId"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "live" }, "fromRevision": { "$ref": "#/$defs/__schema3" } }, "required": ["kind", "fromRevision"], "additionalProperties": false } ] }, "revision": { "$ref": "#/$defs/__schema3" }, "game": { "$ref": "#/$defs/__schema8" }, "status": { "type": "string", "enum": ["active", "completed", "cancelled"] }, "view": { "$ref": "#/$defs/__schema6" }, "context": { "$ref": "#/$defs/__schema6" }, "availableActions": { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "concrete" }, "action": { "$ref": "#/$defs/__schema4" }, "expected": { "$ref": "#/$defs/__schema2" } }, "required": ["kind", "action", "expected"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "parameterized" }, "actionType": { "$ref": "#/$defs/__schema5" }, "inputSchemaId": { "$ref": "#/$defs/__schema5" }, "constraints": { "$ref": "#/$defs/__schema6" }, "expected": { "$ref": "#/$defs/__schema2" } }, "required": [ "kind", "actionType", "inputSchemaId", "constraints", "expected" ], "additionalProperties": false } ] } }, "outcome": { "anyOf": [ { "anyOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "completed" }, "reasonCode": { "$ref": "#/$defs/__schema5" }, "participants": { "type": "object", "propertyNames": { "type": "string", "pattern": "^p(0|[1-9]\\d*)$" }, "additionalProperties": { "type": "object", "properties": { "outcome": { "type": "string", "enum": ["win", "loss", "draw", "neutral"] }, "score": { "type": "number" }, "rank": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "teamId": { "$ref": "#/$defs/__schema5" }, "metrics": { "$ref": "#/$defs/__schema6" } }, "required": ["outcome", "metrics"], "additionalProperties": false } } }, "required": ["kind", "reasonCode", "participants"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "cancelled" }, "reasonCode": { "$ref": "#/$defs/__schema5" } }, "required": ["kind", "reasonCode"], "additionalProperties": false } ] }, { "type": "null" } ] }, "events": { "type": "array", "items": { "type": "object", "properties": { "eventId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "revision": { "$ref": "#/$defs/__schema3" }, "order": { "$ref": "#/$defs/__schema3" }, "type": { "$ref": "#/$defs/__schema5" }, "payload": { "$ref": "#/$defs/__schema6" } }, "required": ["eventId", "revision", "order", "type", "payload"], "additionalProperties": false } } }, "required": [ "protocolVersion", "matchId", "type", "subscriptionId", "delivery", "revision", "game", "status", "view", "context", "availableActions", "outcome", "events" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "type": { "type": "string", "const": "game.ack" }, "commandId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "duplicate": { "type": "boolean" }, "receipt": { "oneOf": [ { "type": "object", "properties": { "status": { "type": "string", "const": "applied" }, "appliedRevision": { "$ref": "#/$defs/__schema3" } }, "required": ["status", "appliedRevision"], "additionalProperties": false }, { "type": "object", "properties": { "status": { "type": "string", "const": "rejected" }, "code": { "type": "string", "enum": [ "STALE_REVISION", "STALE_PHASE", "STALE_ACTOR", "ILLEGAL_ACTION", "MATCH_FINISHED" ] }, "observedRevision": { "$ref": "#/$defs/__schema3" } }, "required": ["status", "code", "observedRevision"], "additionalProperties": false } ] } }, "required": [ "protocolVersion", "matchId", "type", "commandId", "duplicate", "receipt" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "requestId": { "$ref": "#/$defs/__schema9" }, "type": { "type": "string", "const": "game.sync" }, "knownRevision": { "anyOf": [ { "$ref": "#/$defs/__schema3" }, { "type": "null" } ] }, "client": { "type": "object", "properties": { "engineApiVersion": { "type": "number", "const": 1 }, "presentationApiVersion": { "type": "number", "const": 1 }, "presentations": { "minItems": 1, "type": "array", "items": { "$ref": "#/$defs/__schema8" } } }, "required": [ "engineApiVersion", "presentationApiVersion", "presentations" ], "additionalProperties": false } }, "required": [ "protocolVersion", "matchId", "requestId", "type", "knownRevision", "client" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "type": { "type": "string", "const": "game.unsubscribe" }, "subscriptionId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": ["protocolVersion", "matchId", "type", "subscriptionId"], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "requestId": { "$ref": "#/$defs/__schema9" }, "type": { "type": "string", "const": "game.command-status" }, "commandId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "protocolVersion", "matchId", "requestId", "type", "commandId" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "requestId": { "$ref": "#/$defs/__schema9" }, "type": { "type": "string", "const": "game.command-unknown" }, "commandId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "required": [ "protocolVersion", "matchId", "requestId", "type", "commandId" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "$ref": "#/$defs/__schema0" }, "matchId": { "$ref": "#/$defs/__schema1" }, "type": { "type": "string", "const": "game.cursor" }, "subscriptionId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "revision": { "$ref": "#/$defs/__schema3" } }, "required": [ "protocolVersion", "matchId", "type", "subscriptionId", "revision" ], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "matchId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "type": { "type": "string", "const": "game.error" }, "requestId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "commandId": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "code": { "type": "string", "enum": [ "INVALID_MESSAGE", "UNSUPPORTED_PROTOCOL", "UNAUTHORIZED", "NOT_PARTICIPANT", "STALE_REVISION", "STALE_PHASE", "STALE_ACTOR", "ILLEGAL_ACTION", "MATCH_FINISHED", "COMMAND_ID_REUSED", "PACKAGE_UNAVAILABLE", "INCOMPATIBLE_CLIENT", "RATE_LIMITED", "INTERNAL_ERROR" ] }, "recovery": { "type": "string", "enum": [ "none", "sync", "retry-same-command", "reload-client", "reauthenticate" ] }, "messageKey": { "$ref": "#/$defs/__schema5" } }, "required": ["protocolVersion", "type", "code", "recovery", "messageKey"], "additionalProperties": false } ], "$defs": { "__schema0": { "type": "number", "const": 1 }, "__schema1": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "__schema2": { "oneOf": [ { "type": "object", "properties": { "kind": { "type": "string", "const": "match" }, "revision": { "$ref": "#/$defs/__schema3" } }, "required": ["kind", "revision"], "additionalProperties": false }, { "type": "object", "properties": { "kind": { "type": "string", "const": "actor" }, "phaseEpoch": { "$ref": "#/$defs/__schema3" }, "actorRevision": { "$ref": "#/$defs/__schema3" } }, "required": ["kind", "phaseEpoch", "actorRevision"], "additionalProperties": false } ] }, "__schema3": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "__schema4": { "type": "object", "properties": { "type": { "$ref": "#/$defs/__schema5" }, "payload": { "$ref": "#/$defs/__schema6" } }, "required": ["type", "payload"], "additionalProperties": false }, "__schema5": { "type": "string", "pattern": "^[a-z][a-zA-Z0-9.-]{0,79}$" }, "__schema6": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "$ref": "#/$defs/__schema7" } }, "__schema7": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" }, { "type": "array", "items": { "$ref": "#/$defs/__schema7" } }, { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "$ref": "#/$defs/__schema7" } } ] }, "__schema8": { "type": "object", "properties": { "id": { "$ref": "#/$defs/__schema5" }, "rulesVersion": { "type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$" }, "viewSchemaVersion": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "eventSchemaVersion": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 } }, "required": [ "id", "rulesVersion", "viewSchemaVersion", "eventSchemaVersion" ], "additionalProperties": false }, "__schema9": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, "$id": "urn:juegoland:protocol:1" }