Fix broken $refs from the bambulab schema underscore-rename, remove stale v2/

- print.schema.json, _ams.schema.json, _ams_unit.schema.json still
  pointed at the pre-rename filenames (ams.schema.json, ams_unit.schema.json,
  ams_tray.schema.json) after the underscore-prefix split - fixed all
  three, verified with a full jsonschema + referencing validation run
  against real captures (get_version, pushall, a full print/ams/xcam
  report with both empty and loaded trays) plus negative tests.
- _upgrade_state.schema.json: fixed its $id (pointed at report/info/,
  file lives under report/print/) and its title (said "ModuleInfo",
  clearly copy-pasted from _module_info.schema.json). Wired it into
  print.schema.json as the print report's `upgrade_state` property -
  the file existed but nothing referenced it yet.
- Deleted schemas/bambulab/v2/, which had been recreated as stale,
  broken copies of an older v1 (missing the envelope allOf, missing
  the underscore renames, $ids still pointing at v1/ paths) - the
  repo's own README documents v2 as intentionally removed until V2's
  wire format is known to differ from V1's.
- Updated schemas/bambulab/README.md's layout tree and inheritance-
  example reference, both stale after the underscore rename.
- Removed stray tsc -b build output (packages/ts-types/src/*.d.ts/js)
  that isn't meant to be committed (outDir is dist/, gitignored).

Verified: cargo check clean (continuum-proxy, continuum-ai-worker,
rust-types), tsc clean (continuum-backend, continuum-common ts-core),
10/10 JSON Schema validation cases passing.
This commit is contained in:
2026-08-29 08:13:49 +00:00
parent cd18337e12
commit 4cc40c913c
20 changed files with 213 additions and 128 deletions
+24 -21
View File
@@ -1,7 +1,7 @@
# bambulab/ JSON Schemas
Documentation/validation schemas for Bambu's raw MQTT wire format, mirroring
continuum-proxy's `src/printer/bambu_commands/` not used for codegen (the
continuum-proxy's `src/printer/bambu_commands/` - not used for codegen (the
Rust structs there are hand-written; see that module's doc comment for why),
but genuinely useful on their own: language-agnostic documentation of the
wire format, and usable to validate a captured MQTT payload without writing
@@ -11,11 +11,11 @@ any Rust to do it.
```
bambulab/
envelope.schema.json the base sequence_id + command, shared by
envelope.schema.json the base - sequence_id + command, shared by
every command in every generation, so it lives
here unversioned, not duplicated under v1/v2
v1/
request.schema.json BambuRequest dispatcher one key per category
request.schema.json BambuRequest dispatcher - one key per category
("info", "pushing", ...), each a oneOf (a
category can have more than one request shape)
report.schema.json BambuReport dispatcher, same idea
@@ -27,15 +27,18 @@ bambulab/
report/
info/
get_version.schema.json
module_info.schema.json
_module_info.schema.json
print/
print.schema.json the ongoing print-state push
ams.schema.json
ams_unit.schema.json
ams_tray.schema.json
xcam.schema.json
_ams.schema.json
_ams_unit.schema.json
_ams_tray.schema.json
_vt_tray.schema.json shared base for AmsTray + the virtual/
external spool slot, via allOf + $ref
_upgrade_state.schema.json
_xcam.schema.json
v2/ add the same split once V2's wire format is
known to differ from V1's removed for now
known to differ from V1's - removed for now
rather than leave broken copy-pasted stubs
```
@@ -43,9 +46,9 @@ bambulab/
whatever a `pushall` request triggers is `report/print/`, not
`report/pushing/`. Sending `pushall` (which *does* go to the `pushing` key
on the request side) makes the printer start/refresh an ongoing state-push
stream, and that stream arrives under the `print` key a different root
stream, and that stream arrives under the `print` key - a different root
key from the request that triggered it. A category folder here means
"what root key does this arrive under", not "what request caused it" the
"what root key does this arrive under", not "what request caused it" - the
first version of this schema got that wrong (see git history) before a
closer read of the real capture caught it.
@@ -65,35 +68,35 @@ Every command/response schema *extends* `envelope.schema.json` with
This is genuinely closer to real inheritance than anything else in this
project's schema stack (proto, Rust): the instance must satisfy the base
schema *and* the extension schema simultaneously, and verified with
negative test cases, not just asserted `envelope.schema.json`'s
schema *and* the extension schema simultaneously, and - verified with
negative test cases, not just asserted - `envelope.schema.json`'s
`required: ["sequence_id", "command"]` is actually enforced on every
schema that extends it, not just copy-pasted as documentation.
`v1/report/print/ams_tray.schema.json` is the other JSON-Schema-specific
`v1/report/print/_ams_tray.schema.json` is the other JSON-Schema-specific
tool worth knowing: `oneOf`, for "this is exactly one of several
genuinely different shapes" (an AMS tray slot is either empty just
`id` or loaded the full field set never something in between).
genuinely different shapes" (an AMS tray slot is either empty - just
`id` - or loaded - the full field set - never something in between).
`oneOf` requires exactly one branch to match; watch out for a base-style
branch (like `EmptyTray`) accidentally also matching a more specific
branch's instance if the specific branch doesn't require enough fields
branch's instance if the specific branch doesn't require enough fields -
verified and fixed once already here, see that file's description.
**One gotcha if you add a new base-style schema**: don't set
`"additionalProperties": false` on something meant to be `allOf`-extended.
`allOf` validates every sub-schema against the *whole* instance
independently it doesn't merge object schemas so a closed base schema
independently - it doesn't merge object schemas - so a closed base schema
would reject every field the extending schema adds. Leave
`additionalProperties` unset (defaults to allowed) on anything used as a
base; enforce closedness only on the top-level dispatcher schemas
(`v1/request.schema.json`/`v1/report.schema.json` do this correctly
(`v1/request.schema.json`/`v1/report.schema.json` do this correctly -
check their `additionalProperties: false`).
## `$id` convention
Every schema's `$id` is its real Gitea raw-file URL:
`https://git.octoturge.com/Continuum/continuum-schemas/raw/branch/main/schemas/bambulab/...`
a genuinely dereferenceable URI (verified: `raw/branch/main/<path>` is
- a genuinely dereferenceable URI (verified: `raw/branch/main/<path>` is
the correct Gitea pattern, not `raw/<path>` or `raw/<branch>/<path>`),
rather than a made-up placeholder domain. `$ref`s between files stay
relative paths; `$id` is what a validator uses as the base URI to resolve
@@ -103,7 +106,7 @@ standalone by anything that wants to dereference it directly.
## Validating something
`$ref` resolution here relies on each schema's `$id` as the base URI for
its own relative refs (standard JSON Schema behavior) register schemas
its own relative refs (standard JSON Schema behavior) - register schemas
by `$id`, not by filename, or you'll hit collisions (`get_version.schema.json`
exists under both `request/info/` and `report/info/`):