100 lines
4.0 KiB
JSON
100 lines
4.0 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://dogama.dev/schemas/module-manifest-v1.json",
|
|
"title": "DoGaMa WebAssembly module manifest v1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["schema_version", "id", "name", "version", "description", "license", "game_ids", "runtime", "compatibility", "capabilities", "permissions", "configuration", "artifacts"],
|
|
"properties": {
|
|
"schema_version": { "const": 1 },
|
|
"id": { "$ref": "#/$defs/id" },
|
|
"name": { "type": "string", "minLength": 1, "maxLength": 150 },
|
|
"version": { "$ref": "#/$defs/semver" },
|
|
"description": { "type": "string", "minLength": 1, "maxLength": 1000 },
|
|
"license": { "type": "string", "minLength": 1, "maxLength": 100 },
|
|
"homepage": { "type": "string", "format": "uri", "pattern": "^https://" },
|
|
"game_ids": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
|
|
"runtime": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["type", "abi"],
|
|
"properties": {
|
|
"type": { "const": "wasm" },
|
|
"abi": { "const": "dogama:game-module@1.0.0" }
|
|
}
|
|
},
|
|
"compatibility": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["manager_api", "module_api"],
|
|
"properties": {
|
|
"manager_api": { "type": "string", "minLength": 1, "maxLength": 50 },
|
|
"module_api": { "type": "string", "minLength": 1, "maxLength": 50 }
|
|
}
|
|
},
|
|
"capabilities": {
|
|
"type": "array",
|
|
"uniqueItems": true,
|
|
"items": { "$ref": "#/$defs/capability" }
|
|
},
|
|
"permissions": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["network"],
|
|
"properties": {
|
|
"network": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["scope", "protocols", "port_ids"],
|
|
"properties": {
|
|
"scope": { "const": "instance_only" },
|
|
"protocols": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["http", "https", "tcp"] } },
|
|
"port_ids": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "#/$defs/id" } },
|
|
"http_methods": { "type": "array", "uniqueItems": true, "items": { "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"] } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"limits": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"memory_mb": { "type": "integer", "minimum": 1, "maximum": 256 },
|
|
"timeout_ms": { "type": "integer", "minimum": 100, "maximum": 60000 },
|
|
"max_response_bytes": { "type": "integer", "minimum": 1024, "maximum": 16777216 },
|
|
"max_concurrent_calls": { "type": "integer", "minimum": 1, "maximum": 16 }
|
|
}
|
|
},
|
|
"configuration": {
|
|
"type": "array",
|
|
"maxItems": 64,
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "type", "required"],
|
|
"properties": {
|
|
"id": { "$ref": "#/$defs/id" },
|
|
"type": { "enum": ["string", "integer", "boolean", "secret"] },
|
|
"required": { "type": "boolean" },
|
|
"description": { "type": "string", "maxLength": 500 },
|
|
"default": {}
|
|
}
|
|
}
|
|
},
|
|
"artifacts": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["wasm", "sha256"],
|
|
"properties": {
|
|
"wasm": { "type": "string", "pattern": "^[A-Za-z0-9._-]+\\.wasm$", "maxLength": 200 },
|
|
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
}
|
|
}
|
|
},
|
|
"$defs": {
|
|
"id": { "type": "string", "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$", "minLength": 1, "maxLength": 100 },
|
|
"semver": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$" },
|
|
"capability": { "enum": ["server_info", "metrics", "player_list", "online_save", "graceful_shutdown", "announcement", "kick", "ban", "unban"] }
|
|
}
|
|
}
|