zplCore.comzplCore.com

LabelSchema

public static class LabelSchema

Migrations of the label JSON template between schema versions. Version 1 = templates without "schemaVersion"; version 2 adds text sizing modes and dither methods; version 3 adds duplex, localized strings/culture, ZPL optimisation, per-side text frames, table corner rounding, counter/mask options.
Compatibility rule. Within a version changes are additive only: new optional properties whose initial value prints exactly what labels printed before. Renaming or removing a property, changing its type, meaning or initial value (JSON leaves out values equal to the initial value, so a new initial value changes stored labels) requires Label.CurrentSchemaVersion + 1 and a step in LabelSchema.Migrate that rewrites older JSON. Enforced by tests: docs/files/label.schema.json must equal LabelSchema.JsonSchema, the generated schema must contain the frozen schema of the current version unchanged (tests/ZplCore.Tests/Schema/label.schema.v{N}.json), and every frozen fixture of an older version must still load and print its frozen ZPL.

Methods

Method SignatureReturnsDescription
static # JsonSchema()JsonNodeJSON Schema (draft 2020-12) of the label JSON, generated from the model: item types by their type discriminator, enums by name, and the initial value of every property as default (a property left out of a label JSON has this value).
static # Migrate(JsonObject label)intUpgrades a label JSON object in place to Label.CurrentSchemaVersion; returns the original version.