Files
OrcaSlicer/scripts/profile_library.schema.json
T
SoftFever 46adf18765 Publish a filament and printer model library for other softwares (#18168)
* Define the profile library format other Orca software reads

Describes the file that will tell OrcaSonar, OrcaCloud and other readers which filament
products exist and which fit each printer model, with its JSON Schema and a shared test
fixture every reader runs, so they all read the file the same way.

* Collect which filaments every printer preset accepts

The rule the AMS tray dialog uses to offer filaments can now be applied to any printer
preset, and a new export gathers, for every system printer preset, the filaments it
accepts with the products, printer models and bundles they name. It is the data behind
the profile library. The dialog itself offers the same filaments as before.

* Let the profile validator export the profile library data

OrcaSlicer_profile_validator --export-library <file> writes, for every system printer
preset, the filaments it accepts, loading the profiles the way the app does so the data
matches what users see. Load problems are reported as warnings; the export fails only
when it cannot load the profiles or write the file.

* Build the profile library file from the validator's export

scripts/profile_library.py turns the validator's export into the published library format,
checks that the file reads back to exactly the filaments each printer and nozzle accepts,
and gives each publish a version newer than the last. Its reader runs the shared fixture,
so the format's reading rules are tested in OrcaSlicer itself.

* Publish the profile library automatically after each main build

After every successful Build all on main, and on demand, a workflow builds the nightly
library from main and the release library from the latest stable release, and publishes
whatever changed to the profile-library release of OrcaSlicer/orcaslicer-profiles. Runs
publish one at a time and never replace newer data with older, and a run that stops part
way is repaired by the next one.

* Make every profile library reader refuse a file with a bad version or channel

The Python reader accepted a file whose version or channel OrcaSonar's
reader refuses, so the two could disagree about the same file. The
shared fixture now carries both cases, and the format doc states the
rule every reader follows.

* Keep the profile library publish run honest when a step fails

A failed run-picking or tooling step could leave the run green with
nothing published, an unreadable current file could stop the very build
that would replace it, and rerunning all jobs could fail on the earlier
attempt's build. A dry run also reported a lower version than a publish
would give after a run that stopped part way.

* Read library versions alike in every reader, and never let the report stop a build

The Python reader accepted a version with a trailing newline or a
non-ASCII digit that the other readers refuse; the shared fixture now
carries both cases. A damaged current file in any form, or a recorded
version with an impossible date, now only marks the build's report as
changed instead of stopping the build that would repair the release.

* Stop a profile library publish clearly on a hand-edited release record

A release description line whose version publish cannot read made the
publish run crash with a traceback, while a dry run quietly ignored it.
Publish now stops before writing anything with a message naming the
line to correct, and a dry run warns that a publish would stop on it.

* Refuse any hand-edited profile library release record before publishing

A record line missing a field was read as no record, so publish could
replace a file with a lower version, and a bad build line crashed the
run with a traceback. Publish now stops before writing anything on a
malformed line, a build commit GitHub can't compare, or a file whose
line is gone, naming what to correct; a dry run warns the same way.

* Refuse a duplicated or build-less profile library release record

A second record line for a channel could lower the version floor, and a
deleted build line let an older build replace newer data unchecked.
Publish now stops on either before writing anything and names what to
correct. A first publish, with nothing recorded yet, is unaffected.

* Warn in a profile library dry run of every record publish would stop on

A dry run reported a clean version for a release description without
its build line, though a publish would refuse it. Both now read the
record through the same checks, so the dry run warns of every stop.

* Check a profile library dry run against the release's asset list

A dry run judged whether a channel's file was on the release by whether
it could download it, while a publish reads the release's asset list, so
an upload that never finished could stop a publish without the dry run
warning. The dry run now reads the same description and asset list.

* List filament products first in the profile library file

Someone opening a library file now meets the filament catalogue right after the channel, instead
of scrolling past the long list of ids that fit every printer first. The data, its hash and the
version are unchanged, so readers and bots see the same library.

* Describe the filaments every printer fits as branded and generic alike

* Call the filaments every printer fits universal_filaments in the profile library

The list of filament products that fit every printer model is now named universal_filaments
instead of everywhere, so someone reading a library file can tell what it holds without the docs.
No library has been published yet, so no reader in use depends on the old name.

* Make the profile library schema refuse values ending in a newline in every validator

A validator that reads the schema's patterns as Python does accepted a version, commit, data hash
or filament id followed by a newline, which every library reader refuses. The schema now refuses
them under either regex dialect.

* Say that a profile bundle that fails to load stops the library export

The export's notes said load errors were only warnings, but a bundle that fails to load stops it,
on purpose: a published file without that bundle would drop all of its printers or filaments. The
comment and the design doc now say so.
2026-12-05 18:32:10 +08:00

91 lines
4.4 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/OrcaSlicer/OrcaSlicer/blob/main/scripts/profile_library.schema.json",
"title": "OrcaSlicer profile library, orca.profile_library.v1",
"description": "Filament products, printer models and the products that fit each model, compiled from OrcaSlicer's system profiles. Format and reading rules: docs/HLSD/profile-library.md. Readers ignore fields they don't know, so every object allows more properties than it lists.",
"type": "object",
"required": ["schema", "version", "channel", "source", "filaments", "universal_filaments", "printer_models"],
"properties": {
"schema": { "const": "orca.profile_library.v1" },
"version": {
"description": "The OrcaSlicer version without its suffix, then the UTC minute the file was published. Only ever increases within a channel.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+_[0-9]{12}(?!\\n)$"
},
"channel": { "enum": ["nightly", "release"] },
"source": {
"type": "object",
"required": ["orca_version", "commit", "data_hash", "bundles"],
"properties": {
"orca_version": { "description": "The full OrcaSlicer version of the profiles, such as 2.6.0-dev.", "type": "string", "minLength": 1 },
"commit": { "description": "The OrcaSlicer commit the profiles were read from.", "type": "string", "pattern": "^[0-9a-f]{40}(?!\\n)$" },
"data_hash": {
"description": "SHA-256 of the file without version and source, as compact JSON with sorted keys.",
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}(?!\\n)$"
},
"bundles": {
"description": "Each profile bundle's id and version.",
"type": "object",
"additionalProperties": { "type": "string" }
},
"tag": { "description": "Release file only: the stable OrcaSlicer release tag the profiles were read at.", "type": "string", "minLength": 1 }
}
},
"filaments": {
"description": "Every filament product the library knows, keyed by filament_id.",
"type": "object",
"propertyNames": { "$ref": "#/$defs/filament_id" },
"additionalProperties": {
"type": "object",
"required": ["vendor", "name", "type"],
"properties": {
"vendor": { "type": "string" },
"name": { "type": "string" },
"type": { "type": "string" }
}
}
},
"universal_filaments": {
"description": "Products that fit every printer model, unless the model lists them in hidden.",
"$ref": "#/$defs/filament_ids"
},
"printer_models": {
"description": "Printer models keyed by model name.",
"type": "object",
"additionalProperties": {
"type": "object",
"required": ["vendor", "model_id", "nozzles", "filaments", "hidden", "nozzle_limits"],
"properties": {
"vendor": { "description": "The display name of the model's profile bundle.", "type": "string", "minLength": 1 },
"model_id": { "description": "The model's id in the profiles. Empty when the profiles give it none; readers never index an empty id.", "type": "string" },
"nozzles": {
"description": "The model's nozzles, each named as its printer presets name it, such as 0.4 or 0.4HF.",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "minLength": 1 }
},
"filaments": { "description": "The model's own products, on top of universal_filaments.", "$ref": "#/$defs/filament_ids" },
"hidden": { "description": "Products in universal_filaments that this model does not offer.", "$ref": "#/$defs/filament_ids" },
"nozzle_limits": {
"description": "Products that fit only some of the model's nozzles, with those nozzles.",
"type": "object",
"propertyNames": { "$ref": "#/$defs/filament_id" },
"additionalProperties": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "minLength": 1 }
}
}
}
}
}
},
"$defs": {
"filament_id": { "type": "string", "pattern": "^OF[0-9A-Za-z]{6}(?!\\n)$" },
"filament_ids": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/filament_id" } }
}
}