feat(cli): validate rm-* and JSON component attributes at validation time#33
Merged
Merged
Conversation
LLM authoring errors now surface at validation instead of vanishing at render: - new validate_attrs module builds a per-tag known-attribute map from the schemars JSON Schema (flattened TimingConfig fields verified to be inlined; wrapper keys and serde tag aliases handled explicitly) - unknown attributes warn with a did-you-mean suggestion and the known set; --strict-attrs promotes them to errors (JSON and HTML sources) - typed-parse failures are now always blocking: a child that fails typed deserialization is dropped at render, so validate previously saying 'valid' was a lie (this also surfaces unknown CSS properties from the HTML dialect with a readable error)
This was referenced Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17.
Goal: LLM authoring mistakes surface at
rustmotion validate, not silently at render.validate_attrsmodule: a lazy per-tag known-attribute map generated fromschemars::schema_for!(Component). Verified empirically that flattenedTimingConfigfields are inlined per variant (no allowlist needed); explicit handling for wrapper keys (position/x/y/z-index), the two serde tag aliases, and recursion intochildrenonly for real containers. No component has catch-all/dynamic keys (audited).unknown attribute 'sufix' on 'counter' — … (did you mean 'suffix'? …). New--strict-attrsflag promotes to errors. Applies to JSON scenarios too — same safety net either way.CssStyleisdeny_unknown_fields).Tests: 8 new (TDD) — exact-name warning, strict promotion, flatten/wrapper non-flagging, clean-scenario zero warnings, nested paths, alias tags, blocking invalid component, readable CSS error from HTML.
showcase.html/hello.htmlstay green with zero attr warnings (no false positives).Verify:
cargo test --workspace→ 159 passed ✓ ·cargo fmt --check✓ · clippy 0 warnings ✓ · manual end-to-end: typo warns (exit 0) /--strict-attrserrors (exit 1) ✓