Files
continuum-schemas/schemas/bambulab/v1/common/ams/ams_tray.schema.json
T

38 lines
1.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/v1/common/ams/ams_tray.schema.json",
"title": "AmsTray",
"description": "A tray slot is either empty (just `id`) or loaded (the full field set) - two genuinely different shapes for the same slot, not one shape with optional fields. oneOf says the instance must match EXACTLY one of these. Note LoadedTray requires every field it lists, not just `id` - with only `id` required, a bare {\"id\":\"0\"} would validate against BOTH branches at once (it trivially satisfies Loaded's single requirement too) and oneOf would fail, since oneOf demands exactly one match. Verified this the hard way - see git history. The Rust equivalent is an untagged enum with #[serde(deny_unknown_fields)] on the Empty variant, for the same reason in reverse: without it, a loaded tray's extra fields wouldn't be rejected by Empty, and untagged enums try variants in order - see bambu_commands/print.rs. `drying_time` and `drying_temp` fields are only available for AMS 2 and AMS HT - AMS 1 doesn't have the drying option.",
"oneOf": [
{
"title": "EmptyTray",
"type": "object",
"properties": {
"id": { "type": "string" }
},
"required": ["id"],
"additionalProperties": false
},
{
"allOf": [
{ "$ref": "../vt_tray.schema.json" },
{
"title": "LoadedTray",
"type": "object",
"properties": {
"state": { "type": "integer" },
"total_len": { "type": "number", "minimum": 0 },
"ctype": { "type": "integer" },
"cols": { "type": "array", "items": { "type": "string" } },
"drying_time": { "type": "string" },
"drying_temp": { "type": "string" }
},
"required": [
"state", "total_len", "ctype", "cols"
]
}
]
}
]
}