fix: preserve interior capitals in camel-key for camelCase-declared arguments - #356
Merged
Merged
Conversation
…rguments The camel-key helper lowercased the entire first word of a declared argument name, so keys declared in camelCase (e.g. navbar's overlayMode) compiled to an all-lowercase camelKey (overlaymode). Args/InitArgs then stored provided values under that key while consuming partials read the declared camelCase name — provided values were silently dropped and the schema default applied instead (e.g. navigation.overlayMode = 'light' rendered a dark navbar). Lowercase only the first rune of the first word: kebab- and snake-case names camelize exactly as before, and camelCase-declared names now keep their interior capitals. Adds a camelcase golden group covering camel-declared, kebab-declared, and lowercase-declared keys plus the compiled schema; all existing goldens are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
🎉 This PR is included in version 6.8.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
ArgsSchema.html's inlinecamel-keyhelper lowercases the entire first word of a declared argument name. A key declared in camelCase — e.g.overlayModein hinode'snavbar.yml— therefore compiles to the camelKeyoverlaymode.Args.html/InitArgs.htmlstore provided values under that camelKey, but consuming partials read the declared camelCase name ($args.overlayMode), so provided values are silently dropped and the schema default applies.Real-world effect found while upgrading a production site to the v3 module generation:
navigation.overlayMode = "light"never reached the navbar partial, which fell back todarkand rendered white nav links over a light hero. No warning is emitted — the value validates fine and then vanishes.Keys declared in kebab-case (
logo-align) or snake_case are unaffected, which is why the demo sites never showed it.Fix
Lowercase only the first rune of the first word. Kebab/snake names camelize exactly as before (
logo-align→logoAlign); camelCase-declared names keep their interior capitals (overlayMode→overlayMode).Note:
utilities/camelize.htmlhas the same first-word-lowercasing logic; left untouched here to keep this PR scoped to the args engine, but it may deserve the same treatment.Tests
camelcasegolden group: camel-declared provided + defaulted, kebab-declared, lowercase-declared, and the compiled schema camelKeys.npm test: golden check passed (14 groups); all existing goldens byte-identical — no behavior change for kebab/snake/lowercase keys.data-bs-theme="light", matching its pre-upgrade production output.🤖 Generated with Claude Code