Closed Simply007 closed 2 years ago
When I run the model generator with codename _3_section_items and using nameResolver as asny value camelCase, pascalCase, snakeCase I get an error.
_3_section_items
camelCase or pascalCase
SyntaxError: An identifier or keyword cannot immediately follow a numeric literal. (8:6) 6 | */ 7 | export type MainMenu = IContentItem<{ > 8 | 3SectionItems: Elements.LinkedItemsElement<IContentItem>;
snakeCase
SyntaxError: Numeric separators are not allowed here. (8:6) 7 | export type MainMenu = IContentItem<{ > 8 | 3_section_items: Elements.LinkedItemsElement<IContentItem>;
Usage:
await generateModelsAsync({ sdkType: 'delivery', projectId: process.env.KONTENT_PROJECT_ID, addTimestamp: true, nameResolver: 'camelCase', })
The model generator does not fail and generates the codename with some prefix.
Generation could also fail with a more polished error.
This has been fixed in the name resolvers in delivery SDK. There is also a test for this specific name (starting with underscore - name )
Brief bug description
When I run the model generator with codename
_3_section_items
and using nameResolver as asny value camelCase, pascalCase, snakeCase I get an error.camelCase or pascalCase
snakeCase
Usage:
Expected behavior
The model generator does not fail and generates the codename with some prefix.
Additional context
Generation could also fail with a more polished error.