From 8525471dee3c59b7fff7490be83fead5f4034e9d Mon Sep 17 00:00:00 2001 From: Artyom Keydunov Date: Tue, 9 Jun 2026 11:39:47 -0700 Subject: [PATCH] feat(schema-compiler): capitalize ID acronyms in default meta titles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../src/compiler/CubeToMetaTransformer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-schema-compiler/src/compiler/CubeToMetaTransformer.ts b/packages/cubejs-schema-compiler/src/compiler/CubeToMetaTransformer.ts index aeb6f5f862c75..6587067dd909c 100644 --- a/packages/cubejs-schema-compiler/src/compiler/CubeToMetaTransformer.ts +++ b/packages/cubejs-schema-compiler/src/compiler/CubeToMetaTransformer.ts @@ -473,7 +473,10 @@ export class CubeToMetaTransformer implements CompilerInterface { } private titleize(name: string): string { - return inflection.titleize(inflection.underscore(camelCase(name, { pascalCase: true }))); + const titleized = inflection.titleize(inflection.underscore(camelCase(name, { pascalCase: true }))); + // Capitalize common identifier acronyms so e.g. `userId` reads as "User ID" + // rather than "User Id" and an `id` member becomes "ID" instead of "Id". + return titleized.replace(/\bId(s?)\b/g, (_match, plural) => `ID${plural}`); } private transformDimensionFormat({ format: formatOrName, type }: ExtendedCubeSymbolDefinition): DimensionFormat | undefined {