Publish browser subscription wire contracts

This commit is contained in:
Meta Vens 2026-08-17 23:26:51 +02:00
commit 3fe2e9be1b
14 changed files with 462 additions and 2 deletions

View file

@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.database-change-raw.schema.json",
"title": "CultNet Raw Database Change Message",
"type": "object",
"required": ["schemaVersion", "messageId", "subscriptionId", "changeKind"],
"additionalProperties": false,
"properties": {
"schemaVersion": { "const": "cultnet.database_change_raw.v0" },
"messageId": { "type": "string", "minLength": 1 },
"subscriptionId": { "type": "string", "minLength": 1 },
"changeKind": { "enum": ["added", "updated", "removed"] },
"document": { "$ref": "./cultnet.raw-document-record.schema.json" },
"recordKey": { "type": "string", "minLength": 1 },
"schemaId": { "type": "string", "minLength": 1 }
},
"allOf": [
{
"if": { "properties": { "changeKind": { "const": "removed" } } },
"then": { "required": ["recordKey", "schemaId"] },
"else": { "required": ["document"] }
}
]
}

View file

@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.database-subscribe.schema.json",
"title": "CultNet Database Subscribe Message",
"type": "object",
"required": ["schemaVersion", "messageId", "subscriptionId", "includeSnapshot"],
"additionalProperties": false,
"properties": {
"schemaVersion": { "const": "cultnet.database_subscribe.v0" },
"messageId": { "type": "string", "minLength": 1 },
"subscriptionId": { "type": "string", "minLength": 1 },
"schemaIds": { "type": "array", "items": { "type": "string", "minLength": 1 } },
"recordKeys": { "type": "array", "items": { "type": "string", "minLength": 1 } },
"includeSnapshot": { "type": "boolean" },
"consumerRuntimeId": { "type": "string", "minLength": 1 },
"bodyIds": { "type": "array", "items": { "type": "string", "minLength": 1 } },
"supportedBodyTransports": { "type": "array", "items": { "type": "string", "minLength": 1 } }
}
}

View file

@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.database-unsubscribe.schema.json",
"title": "CultNet Database Unsubscribe Message",
"type": "object",
"required": ["schemaVersion", "messageId", "subscriptionId"],
"additionalProperties": false,
"properties": {
"schemaVersion": { "const": "cultnet.database_unsubscribe.v0" },
"messageId": { "type": "string", "minLength": 1 },
"subscriptionId": { "type": "string", "minLength": 1 }
}
}

View file

@ -370,6 +370,27 @@ namespace GameCult.Networking
WireContracts = new[] { CultNetWireContracts.SchemaV0 }
},
new SchemaResourceSpec
{
FileName = "cultnet.database-subscribe.schema.json",
Kind = "wire_message",
SchemaVersion = CultNetSchemaVersions.DatabaseSubscribe,
WireContracts = new[] { CultNetWireContracts.SchemaV0 }
},
new SchemaResourceSpec
{
FileName = "cultnet.database-unsubscribe.schema.json",
Kind = "wire_message",
SchemaVersion = CultNetSchemaVersions.DatabaseUnsubscribe,
WireContracts = new[] { CultNetWireContracts.SchemaV0 }
},
new SchemaResourceSpec
{
FileName = "cultnet.database-change-raw.schema.json",
Kind = "wire_message",
SchemaVersion = CultNetSchemaVersions.DatabaseChangeRaw,
WireContracts = new[] { CultNetWireContracts.SchemaV0 }
},
new SchemaResourceSpec
{
FileName = "cultnet.schema-descriptor.schema.json",
Kind = "shared_contract",