feat(schema-compiler): capitalize ID acronyms in default meta titles#11047
feat(schema-compiler): capitalize ID acronyms in default meta titles#11047keydunov wants to merge 1 commit into
Conversation
Default member titles are generated via titleize(), which used inflection.titleize and rendered the identifier suffix as "Id" — so `userId` became "User Id" and an `id` member became "Id". Post-process the titleized string to uppercase the Id/Ids token at word boundaries, so titles read naturally: "User ID", "User IDs", "ID". The word-boundary match leaves words like "Identity" and "Idaho" untouched, and explicit title overrides are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @keydunov's task in 31s —— View job Code ReviewVerdict: LGTM — small, well-scoped change. 0 high, 0 medium, 1 low. DetailsChecklist
Correctness The implementation in private titleize(name: string): string {
const titleized = inflection.titleize(inflection.underscore(camelCase(name, { pascalCase: true })));
return titleized.replace(/\bId(s?)\b/g, (_match, plural) => `ID${plural}`);
}Walking through the cases:
The Low — missing test coverage The PR description's table is essentially a test spec, but no test was added. Given this method affects every default member/cube title rendered in Other considerations
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11047 +/- ##
=======================================
Coverage 58.51% 58.51%
=======================================
Files 216 216
Lines 17265 17266 +1
Branches 3524 3524
=======================================
+ Hits 10102 10103 +1
Misses 6648 6648
Partials 515 515
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Check List
Description of Changes Made
Default member titles in the meta are generated via
titleize()inCubeToMetaTransformer, which usedinflection.titleize. That rendered the identifier suffix as"Id":userId→"User Id"idmember →"Id"This post-processes the titleized string to uppercase the
Id/Idstoken at word boundaries, so default titles read naturally:iduserIduserIdsorderIdidentityProvideridahoThe word-boundary regex only touches the standalone
Id/Idstoken, so words like "Identity" or "Idaho" are unaffected. Explicittitle:overrides in the data model are unaffected sincetitleizeis only the fallback.🤖 Generated with Claude Code