Home Design Record

Schema Packages

Where a Mold IO schema lives, how cast resolves one through a schema note, and why there is no separate schema package.

reviewed
Revised
2026-10-23
Rev
6

Foundry-authored Mold IO schemas live in TypeScript packages. The content/schemas/ tree only holds the human-readable <name>.md schema notes; there are no JSON mirrors there. Mold frontmatter cites schemas as [[wiki-link]] to the schema note — cast resolves the wiki-link, reads package + package_export from the note’s frontmatter, imports the named runtime export, and serializes it into the bundle.

Where a schema lives

The rule: schema lives with its producer; orphan schemas live in foundry.

  • A schema with a TypeScript producer in this repo lives in the producer’s package. Today: summary-nextflow lives in @galaxy-foundry/summarize-nextflow because that package emits it.
  • A schema with no in-repo TS producer (“orphan”) lives in @galaxy-foundry/gxwf-foundry. Today: summary-cwl, galaxy-tool-discovery, galaxy-tool-summary, tests-format.
  • Vendored upstream schemas (e.g. nf-core meta schemas, parsed-tool from @galaxy-tool-util/schema) live in whichever package needs them at runtime.

There is no separate *-schema package. Validators all funnel through one CLI: foundry validate-<name>.

Source chain

  1. Author the canonical JSON Schema at packages/<owner>/src/schemas/<name>/<name>.schema.json (foundry) or packages/summarize-nextflow/src/schema/<name>.schema.json (producer-co-located).
  2. Add the renderable schema note at content/schemas/<name>.md with type: schema, package, package_export, validator_bin: foundry, and validator_subcommand: validate-<name>.
  3. Regenerate <name>.schema.generated.ts via the package’s scripts/sync-schema.mjs (run on prebuild).
  4. Wire a subcommand in packages/gxwf-foundry/src/commands/validate-<name>.ts using createValidator() + runJsonValidator() from lib/.
  5. Register the schema in site/src/lib/schema-registry.ts.

Validator invocation

Generated skills validate through the CLI: foundry validate-<name> <artifact-path>. Cast bundles validator_bin + args ([validator_subcommand, "--schema-sha256", <hash>, "{artifact_path}"]) into _verify.json so validate-artifact can spawn the right command.

The bundle copies the schema at cast time; the validator carries whatever schema its installed package release shipped. When the two differ, the gate inverts: conformant output fails and stale output passes (foundry#643). So the bundle pins the copy it made. The hash is the schema ref’s dst_hash in _provenance.json, the sha256 of JSON.stringify(schema, null, 2) + "\n", and every foundry validate-* that checks against one schema computes the same hash from its own copy. A mismatch exits 4 before any validation. Given the pin and no artifact, the command checks only the pin, which is how the skill’s Validation section checks for skew before the work starts. The pin is added only for a subcommand validator whose schema the bundle copied.

Library validators are also exported from @galaxy-foundry/gxwf-foundry and @galaxy-foundry/summarize-nextflow for TS consumers (the site uses these). Skills should still prefer the CLI so failures reproduce on a developer machine without needing a TS toolchain.

Current schemas

SchemaOwner packageSubcommand
summary-nextflow@galaxy-foundry/summarize-nextflowfoundry validate-summary-nextflow
summary-cwl@galaxy-foundry/gxwf-foundryfoundry validate-summary-cwl
galaxy-tool-discovery@galaxy-foundry/gxwf-foundryfoundry validate-galaxy-tool-discovery
galaxy-tool-summary@galaxy-foundry/gxwf-foundryfoundry validate-galaxy-tool-summary
tests-format@galaxy-foundry/gxwf-foundry (vendored from @galaxy-tool-util/schema)foundry validate-tests-format