8d4a08e36d
Schemas (any notation - proto, JSON Schema) belong in the schemas repo regardless of how many languages currently consume them; that's what makes this 'the schemas repo'. Rust-only code (the hand-written structs in continuum-proxy's bambu_commands/) is a different category and stays where it was. Also restructured per readability feedback: - envelope.schema.json moved out of v1/ to the bambulab/ root - it's shared across protocol generations, not v1-specific, same principle already applied to the (now-removed) proto/bambulab/common.proto. - v1/ split into v1/request/ and v1/report/, one file per command in each, instead of *.request.schema.json / *.response.schema.json filename suffixes doing the same job less clearly. The two top-level dispatcher schemas (matching BambuRequest/BambuReport) stay at the v1/ root since they aren't themselves a single command's schema. Re-verified after restructuring, not just moved and assumed still correct: resolution now has to handle a real basename collision (get_version.schema.json exists in both request/ and report/) — switched the validation approach to register schemas by (their actual base URI) rather than by filename, which is what makes relative resolve correctly here. All three real examples plus the negative tests from the original version still pass.
13 lines
1.1 KiB
JSON
13 lines
1.1 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://continuum.internal/schemas/bambulab/envelope.schema.json",
|
|
"title": "CommandEnvelope",
|
|
"description": "Fields every Bambu MQTT command/response shares, across both protocol generations — unversioned, at the bambulab/ root, not duplicated under v1/ or v2/. This is the 'base class' — other schemas extend it via allOf + $ref. JSON Schema doesn't have inheritance either, strictly speaking (no 'extends' keyword) — allOf is composition: it says the instance must satisfy THIS schema AND whatever else is listed alongside it. It's the closest thing to real inheritance ergonomics of anything used across this project's schema stack (proto, Rust), because $ref + allOf lets you name and reuse a shape without re-declaring its fields, which proto/Rust composition can't quite do (there you still write `common: PrinterReportCommon` by hand on every struct).",
|
|
"type": "object",
|
|
"properties": {
|
|
"sequence_id": { "type": "string" },
|
|
"command": { "type": "string" }
|
|
},
|
|
"required": ["sequence_id", "command"]
|
|
}
|