fix: 对齐多配置运行状态语义 (#149)

This commit is contained in:
QiuSW
2026-08-31 08:59:48 +08:00
parent 54c58551ae
commit a22d3ce0f1
18 changed files with 207 additions and 73 deletions
@@ -12,7 +12,7 @@
"observed_at",
"runtime",
"model",
"configuration",
"configurations",
"health",
"inputs"
],
@@ -44,47 +44,49 @@
"version": { "$ref": "#/$defs/version" }
}
},
"configuration": {
"type": "object",
"additionalProperties": false,
"required": ["apply_state", "applied_revision"],
"properties": {
"apply_state": {
"type": "string",
"enum": ["not_configured", "applying", "applied", "rejected"]
},
"applied_revision": {
"type": ["string", "null"],
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
},
"error_code": { "$ref": "#/$defs/nullableErrorCode" }
},
"allOf": [
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "not_configured" } }
"configurations": {
"type": "array",
"maxItems": 4096,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["config_id", "apply_state", "applied_revision", "error_code"],
"properties": {
"config_id": { "$ref": "#/$defs/configId" },
"apply_state": {
"type": "string",
"enum": ["not_configured", "applying", "applied", "rejected"]
},
"then": { "properties": { "applied_revision": { "type": "null" } } }
},
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "applied" } }
"applied_revision": {
"type": ["integer", "null"],
"minimum": 1
},
"then": { "properties": { "applied_revision": { "type": "string", "minLength": 1 } } }
"error_code": { "$ref": "#/$defs/nullableErrorCode" }
},
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "rejected" } }
"allOf": [
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "not_configured" } }
},
"then": { "properties": { "applied_revision": { "type": "null" } } }
},
"then": {
"required": ["error_code"],
"properties": { "error_code": { "$ref": "#/$defs/errorCode" } }
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "applied" } }
},
"then": { "properties": { "applied_revision": { "type": "integer", "minimum": 1 } } }
},
{
"if": {
"required": ["apply_state"],
"properties": { "apply_state": { "const": "rejected" } }
},
"then": { "properties": { "error_code": { "$ref": "#/$defs/errorCode" } } }
}
}
]
]
}
},
"health": {
"type": "object",
@@ -126,6 +128,12 @@
}
},
"$defs": {
"configId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]*$"
},
"logicalRef": {
"type": "string",
"minLength": 1,