schema_version
Stable constant · Versions and migration
Tier: stable · Kind: constant · Topic: Versions and migration
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
SCHEMA_VERSION | SCHEMA_VERSION | SCHEMA_VERSION | SCHEMA_VERSION | SchemaVersion |
Julia
const SCHEMA_VERSION::String
SCHEMA_VERSION
The .esm FORMAT version (semver string) this implementation targets — the
value written into the esm field of freshly constructed files. Files loaded
from disk keep whatever version they declare; this constant is only the default
for documents the library itself creates (flatten wrappers, MTK/Catalyst
export). Must track the version on the first line of esm-spec.md and in the
bundled schema’s $id, which the SCHEMA_VERSION tracks the bundled schema
test enforces.
Spelled ESM_FORMAT_VERSION until the bindings converged: TypeScript, Rust and
Go all called this SCHEMA_VERSION, and Julia was the only one that did not.
NOT the version of this PACKAGE — that is LIBRARY_VERSION
.
TypeScript
const SCHEMA_VERSION: string
The schema version this library implements, derived from the embedded
schema’s $id (https://earthsciml.org/schemas/esm/<version>/esm.schema.json
)
so it cannot hand-drift from the canonical esm-schema.json. The package
version in package.json is kept in lockstep.
Python
SCHEMA_VERSION: str = _bundled_schema_version()
The .esm FORMAT version this library implements — NOT the version of the
library itself, which is earthsci_ast.LIBRARY_VERSION. Every binding
exports it under this name (API_SPEC.md §6).
Example (version_constants)
print("format version:", earthsci_ast.SCHEMA_VERSION)
print("library version:", earthsci_ast.LIBRARY_VERSION)
assert earthsci_ast.SCHEMA_VERSION.count(".") == 2
Rust
pub const SCHEMA_VERSION: &str = "1.3.0";
ESM schema version supported by this implementation. Must track the
version in esm-schema.json’s $id / esm-spec.md; the
schema_version_matches_bundled_schema test enforces it, and
parse::library_version() (major-compat gating) derives from it.
Example (version_constants)
// The `.esm` format version this library reads and writes, and the
// version of the library itself: two unrelated numbers.
println!("format {SCHEMA_VERSION}, library {LIBRARY_VERSION}");
assert_eq!(SCHEMA_VERSION.split('.').count(), 3);
Go
var SchemaVersion = func() string {
m := schemaIDVersionRe.FindSubmatch(embeddedSchema)
if m == nil {
panic("embedded ESM schema $id does not carry a version")
}
return string(m[1])
}()
SchemaVersion is the schema version this library implements, derived from the embedded schema’s $id so it cannot hand-drift from the canonical esm-schema.json. Mirrors TypeScript’s SCHEMA_VERSION.