supported_migration_targets
Stable function · Versions and migration
Tier: stable · Kind: function · Topic: Versions and migration
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
supported_migration_targets | getSupportedMigrationTargets, supportedMigrationTargets | supported_migration_targets | get_supported_migration_targets, supported_migration_targets | SupportedMigrationTargets |
Note: spelling differs from the §2 rule: rust=get_supported_migration_targets (expected supported_migration_targets); typescript=getSupportedMigrationTargets (expected supportedMigrationTargets); multiple spellings exported by: rust, typescript
Julia
supported_migration_targets(source_version::AbstractString)
supported_migration_targets(source_version::AbstractString) -> Vector{String}
The schema versions source_version can be migrated to.
- A version on the additive line
2.0.0 … <current schema version>→[SCHEMA_VERSION](a no-op marker bump to the current schema). - A 1.x version (
1.0.0 … 1.3.0) →[SCHEMA_VERSION]as well: the relabel across the 2.0.0 break, whichmigrateperforms only for a document that uses none of the constructs 2.0.0 removed. Whether a given document qualifies iscan_migrate(file, target). - Everything else — including EVERY 0.x version, which 1.0.0’s clean break puts
out of reach of a marker bump, plus newer-than-current, other majors, and
malformed strings — →
String[].
Named without the get prefix its TypeScript twin (getSupportedMigrationTargets)
carries; the behaviour is identical.
Examples
supported_migration_targets("1.3.0") # ["2.0.0"] — if no removed construct
supported_migration_targets("0.9.0") # String[] — the clean break
supported_migration_targets("3.0.0") # String[]
supported_migration_targets("1.0") # String[] — malformed
TypeScript
Exported as getSupportedMigrationTargets and supportedMigrationTargets. Both names refer to the same operation.
getSupportedMigrationTargets
function getSupportedMigrationTargets(sourceVersion: string): string[]
Deprecated. Use supportedMigrationTargets.
Deprecated. Use supportedMigrationTargets
. The canonical name is
supported_migration_targets, with no get prefix. Kept for one minor per
API_SPEC.md §10; removed at the next major.
supportedMigrationTargets
function supportedMigrationTargets(sourceVersion: string): string[]
Get the list of schema versions that a given source version can migrate to.
- any version on the additive line
2.0.0 … <current schema version>→[SCHEMA_VERSION](a no-op marker bump to the current schema). - a 1.x version (
1.0.0 … 1.3.0) →[SCHEMA_VERSION]: the version pair is supported, andmigraterelabels the document or refuses it withremoved_op, depending on its content. - everything else — including EVERY 0.x version, which 1.0.0’s clean break
puts out of reach of a marker bump — →
[].
Python
supported_migration_targets(from_version: str) -> list[str]
The schema versions from_version can migrate to.
- a version on the additive line
2.0.0 … <current>, or a 1.x version →[SCHEMA_VERSION](a 1.x source only when it uses none of the removed operators, whichmigratechecks); - everything else — every 0.x version included — →
[].
Rust
Exported as get_supported_migration_targets and supported_migration_targets. Both names refer to the same operation.
get_supported_migration_targets
pub fn get_supported_migration_targets(from_version: &str) -> Vec<String>
Deprecated since 0.2.0: renamed to supported_migration_targets (API_SPEC.md phase-6 G-2)
Deprecated alias of supported_migration_targets
.
Every binding spells this supported_migration_targets (API_SPEC.md §8).
This alias is deprecated and will be removed at the next major
(API_SPEC.md §10).
supported_migration_targets
pub fn supported_migration_targets(from_version: &str) -> Vec<String>
The schema versions from_version can be migrated to.
- any version on the additive line
2.0.0 … <current schema version>→[SCHEMA_VERSION](a no-op marker bump to the current schema); - any 1.x version →
["2.0.0"], the relabel step. It is listed because a 1.x document that uses none of the removed ops IS migratable; whether a particular document is depends on its content, whichmigratechecks; - everything else — including EVERY 0.x version, which 1.0.0’s clean break puts out of reach of a marker bump, plus newer-than-current, other majors and malformed strings — → an empty vector.
This is the single source of truth for the version pairs: can_migrate
is membership in this list and migrate
refuses whatever it omits.
Example (migrate)
// decay.esm is written at format 1.0.0; the current format is a newer
// 1.x, reached by a version-marker bump with no structural change.
assert_eq!(doc.esm, "1.0.0");
assert_eq!(supported_migration_targets(&doc.esm), [SCHEMA_VERSION]);
assert!(can_migrate(&doc.esm, SCHEMA_VERSION));
let migrated = migrate(&doc, SCHEMA_VERSION)?;
assert_eq!(migrated.esm, SCHEMA_VERSION);
// A 0.x document is out of reach: 1.0.0 was a clean break.
assert!(!can_migrate("0.9.0", SCHEMA_VERSION));
Go
func SupportedMigrationTargets(sourceVersion string) []string
SupportedMigrationTargets returns the schema versions sourceVersion can be migrated to.
- any version on the additive line
2.0.0 … <current schema version>, or on the 1.x line1.0.0 … 1.3.0→SchemaVersion. A 1.x source is offered by VERSION; Migrate still refuses a 1.x document that uses a removed construct. - everything else — including EVERY 0.x version, which 1.0.0’s clean break puts out of reach of a marker bump — → an empty slice.
The canonical name drops TypeScript’s get prefix.