myxce/src/configs/schema/hosts.schema.json
Rongsong Shen a14785108c docs(admin-config-tool): commit spec docs and example configs
design.md, research.md (new), brief.md and requirements.md (updated
during spec authoring: Req 1.6 resolved/superseded by bundling, Req
5.5 added, Req 4.3/4.4 extended for limits.yaml) had been sitting
uncommitted since before implementation began -- the entire 18-task
implementation was built against these documents without them ever
landing in git.

src/configs/*.yaml + schema/*.schema.json: the example config
directory and bundled JSON schemas most of the test suite reads as
"real repo fixtures" (test_config_build.py, test_mapping.py,
test_validation.py, etc.) were likewise never committed -- those
tests would silently skip (skipif guards) rather than run for anyone
else checking out this branch.
2026-07-22 10:11:08 +00:00

101 lines
No EOL
3.1 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/hosts.schema.json",
"title": "Hosts and Hostgroups",
"type": "object",
"additionalProperties": false,
"properties": {
"hosts": {
"type": "array",
"items": { "$ref": "#/$defs/Host" }
},
"hostgroups": {
"type": "array",
"items": { "$ref": "#/$defs/HostGroup" }
}
},
"required": ["hosts"],
"$defs": {
"Host": {
"type": "object",
"additionalProperties": false,
"properties": {
"hostname": { "type": "string", "pattern": "^[A-Za-z0-9._-]+$" },
"type": { "type": "string" },
"model": { "type": "string" },
"max_slot": { "type": "integer", "minimum": -1, "description": "-1 means auto-detect" },
"dispatch_window": { "type": "array", "items": { "$ref": "#/$defs/TimeWindow" } },
"sched_stop": { "type": "array", "items": { "$ref": "#/$defs/SchedStop" } },
"resource": { "type": "array", "items": { "$ref": "#/$defs/HostResource" } },
"description": { "type": "string", "maxLength": 4096 }
},
"required": ["hostname"]
},
"HostResource": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string", "pattern": "^[A-Za-z0-9._-]+$" },
"value": {
"description": "Resource value (string or number)",
"oneOf": [
{ "type": "number" },
{ "type": "string" }
]
}
},
"required": ["name"]
},
"TimeWindow": {
"type": "object",
"additionalProperties": false,
"properties": {
"start_time": {
"type": "string",
"description": "[day:]hour[:minute]; day 0-6, hour 0-23, minute 0-59",
"pattern": "^((([0-6]):)?([01]?\\d|2[0-3])(:[0-5]?\\d)?)$"
},
"end_time": {
"type": "string",
"description": "[day:]hour[:minute]; day 0-6, hour 0-23, minute 0-59",
"pattern": "^((([0-6]):)?([01]?\\d|2[0-3])(:[0-5]?\\d)?)$"
}
},
"required": ["start_time", "end_time"]
},
"SchedStop": {
"type": "object",
"additionalProperties": false,
"properties": {
"resname": { "type": "string" },
"sched": { "type": "number" },
"stop": { "type": "number" }
},
"required": ["resname"],
"anyOf": [
{ "required": ["sched"] },
{ "required": ["stop"] }
]
},
"HostGroup": {
"type": "object",
"additionalProperties": false,
"properties": {
"groupname": { "type": "string", "pattern": "^[A-Za-z0-9._-]+$" },
"members": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"pattern": "^(?:all|!|[A-Za-z0-9._*\\[\\]-]+)$"
}
},
"exclude_members": {
"type": "array",
"items": { "type": "string", "pattern": "^(?:all|!|[A-Za-z0-9._*\\[\\]-]+)$" }
}
},
"required": ["groupname", "members"]
}
}
}