Skip to content

feat(schema): export the component schema, load fonts before validating, drop LayerStyle #106

Description

@LeadcodeDev

Part of #102 — wave 1.

Mini-spec

Goal: make the schema surface honest — export a schema that actually describes components, measure text with the fonts the render will use, and delete the dead style model that keeps stale vocabulary alive.

Invariants

  • rustmotion schema output fully describes every Component variant.
  • Validation and render resolve the same typeface for the same text.
  • No public type remains that contradicts the live CSS types on casing or shape.

Out of scope: validate_attrs hardening and SceneEntry diagnostics (wave 2, L4b); the colour parser itself (L2).

Acceptance

  • H2cmd_schema emits schemars::schema_for!(Component) (already built internally at validate_attrs.rs:40) so Scene.children is no longer typed items: true. The output must contain a oneOf over component variants.
  • H5 (fonts)load_custom_fonts runs inside validation::run_checks, before any measurement. Today it is only called on the render path (render.rs:47), so validation measures through the Helvetica/Arial fallback while the render uses the declared face.
  • H8 (code)LayerStyle (schema/style.rs:317+) and its orphaned siblings that shadow live CSS types (schema::BlendMode, schema::Overflow, schema::GridTrack, CardDisplay, schema::Size) are removed, along with their pub use re-exports. Verify each is genuinely unreferenced before deleting.

Files: crates/rustmotion-core/src/schema/**, crates/rustmotion-cli/src/commands/schema.rs, crates/rustmotion-cli/src/commands/validation.rs

Note: crates/rustmotion-core/src/css/style.rs is a different file owned by L3 — do not touch it.

Verify

rtk cargo test --workspace
rtk cargo build --release
./target/release/rustmotion schema | jq '.definitions | keys | length'
for f in examples/*.json; do ./target/release/rustmotion validate -f "$f"; done

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions