Skip to content

fix: preserve interior capitals in camel-key for camelCase-declared arguments - #356

Merged
markdumay merged 1 commit into
mainfrom
fix/camel-key-preserve-camelcase
Jul 28, 2026
Merged

fix: preserve interior capitals in camel-key for camelCase-declared arguments#356
markdumay merged 1 commit into
mainfrom
fix/camel-key-preserve-camelcase

Conversation

@markdumay

@markdumay markdumay commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

ArgsSchema.html's inline camel-key helper lowercases the entire first word of a declared argument name. A key declared in camelCase — e.g. overlayMode in hinode's navbar.yml — therefore compiles to the camelKey overlaymode. Args.html/InitArgs.html store 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 to dark and 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-alignlogoAlign); camelCase-declared names keep their interior capitals (overlayModeoverlayMode).

Note: utilities/camelize.html has 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

  • New camelcase golden 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.
  • Verified on the affected site: with this fix the navbar renders data-bs-theme="light", matching its pre-upgrade production output.

🤖 Generated with Claude Code

…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>
@markdumay
markdumay merged commit da9f3b6 into main Jul 28, 2026
11 checks passed
@markdumay
markdumay deleted the fix/camel-key-preserve-camelcase branch July 28, 2026 09:31
@markdumay

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 6.8.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant