- cultnet.selection.schema.json: schemas/keys gain minItems: 1 (present and empty is refused at the door, never "every schema/key" - omit the field instead); limit documents that it is clamped 1..=200 by the answering server rather than refused outside that range. - cultnet_py/interop_peer.py: handle_server_message refused only an exact ".v1" suffix, so a v2+ selection message fell through to a silent empty-list answer instead of a loud refusal. is_unsupported_cultnet_version matches any cultnet.*.vN with N > 0 instead. test_cultnet.py's R-2 test now covers v2 and v10, not only v1. - mutate-dotnet.ps1: an entry's File (from -Entries, often written with "/") is looked up against the $targets dictionary keyed by -Target's own spelling; a "\\" vs "/" mismatch didn't throw at the lookup - $targets[$file] silently returned $null - so the crash surfaced one call later as a null-argument error inside a .NET path API instead of as "unknown target". Both -Target and every File read from an entry now normalise through Normalize-TargetPath before indexing $targets. Discrepancy: the ruling names "both R-2 sites" for the Python fix; only one site with this exact narrow-match bug exists in packages/cultnet-py and packages/cultmesh-py (cultmesh_py/server.py's handle_message already refuses every unrecognised schemaVersion, v1+ included, through its own default branch). Fixed the one that exists; did not invent a second. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
92 lines
3.2 KiB
JSON
92 lines
3.2 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://github.com/GameCult/CultLib/contracts/cultnet/cultnet.selection.schema.json",
|
|
"title": "CultNet Typed Selection",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"schemas": {
|
|
"type": "array",
|
|
"items": { "type": "string", "minLength": 1 },
|
|
"minItems": 1,
|
|
"description": "Absent means every schema. Present and empty is refused at the door (selection_invalid), never treated as \"every schema\": omit the field instead."
|
|
},
|
|
"keys": {
|
|
"type": "array",
|
|
"items": { "type": "string", "minLength": 1 },
|
|
"minItems": 1,
|
|
"description": "Absent means every key. Present and empty is refused at the door (selection_invalid), never treated as \"every key\": omit the field instead."
|
|
},
|
|
"fields": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/fieldPredicate" }
|
|
},
|
|
"cites": { "$ref": "#/$defs/citation" },
|
|
"cited": { "$ref": "#/$defs/incoming" },
|
|
"projection": {
|
|
"type": "string",
|
|
"enum": ["header", "document"],
|
|
"default": "header"
|
|
},
|
|
"descending": { "type": "boolean", "default": false },
|
|
"limit": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 200,
|
|
"description": "Clamped to 1..=200 by the answering server, not refused outside that range: an absent value or one outside the bound is treated as the nearer bound (absent = 200)."
|
|
},
|
|
"cursor": { "type": "string" }
|
|
},
|
|
"$defs": {
|
|
"recordRef": {
|
|
"type": "object",
|
|
"required": ["schemaId", "recordKey"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"schemaId": { "type": "string", "minLength": 1 },
|
|
"recordKey": { "type": "string", "minLength": 1 }
|
|
}
|
|
},
|
|
"fieldPredicate": {
|
|
"type": "object",
|
|
"required": ["index", "op"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"index": { "type": "string", "minLength": 1 },
|
|
"op": { "type": "string", "enum": ["any_of", "lt", "le", "ge", "gt"] },
|
|
"values": {
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"minItems": 1
|
|
},
|
|
"number": {
|
|
"type": "string",
|
|
"description": "Q-J: a canonical decimal string, never a JSON number. Matches ^-?(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$ and is not \"-0\"; any other spelling is refused typed at the door (selection_invalid), never normalised.",
|
|
"pattern": "^(?!-0$)-?(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
|
|
}
|
|
},
|
|
"oneOf": [
|
|
{ "required": ["values"], "properties": { "op": { "const": "any_of" } } },
|
|
{ "required": ["number"], "properties": { "op": { "enum": ["lt", "le", "ge", "gt"] } } }
|
|
]
|
|
},
|
|
"citation": {
|
|
"type": "object",
|
|
"required": ["target"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"target": { "$ref": "#/$defs/recordRef" },
|
|
"role": { "type": "string", "minLength": 1 }
|
|
}
|
|
},
|
|
"incoming": {
|
|
"type": "object",
|
|
"required": ["role", "exists"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"role": { "type": "string", "minLength": 1 },
|
|
"exists": { "type": "boolean" }
|
|
}
|
|
}
|
|
}
|
|
}
|