The tool generates invalid syntax when the Prismic repository contains invalid API ID Paths.
Historically, it was possible to create a field with the API ID Path including colon characters, e.g. general::banners.
(The project I am working on has many, many legacy fields using this syntax, for better or worse. Updating them all is not viable, as it would require broad code changes.)
Versions
prismic-ts-codegen: 0.1.5
node: 18.14.1
Reproduction
It is no longer possible to create fields with : in the name anymore, so a new test case cannot be produced.
Steps to reproduce
Start with an old prismic repository, containing models with fields whose API ID contain colon characters, e.g. general::banners
Setup the code generation according to the documentation, using PRISMIC_CUSTOM_TYPES_API_TOKEN to generate from the repository
Run the cli tool
What is expected?
Valid TypeScript type defintiions, where fields containing colons are escaped as strings, e.g.
The tool generates invalid syntax when the Prismic repository contains invalid API ID Paths.
Historically, it was possible to create a field with the API ID Path including colon characters, e.g.
general::banners
.(The project I am working on has many, many legacy fields using this syntax, for better or worse. Updating them all is not viable, as it would require broad code changes.)
Versions
Reproduction
It is no longer possible to create fields with
:
in the name anymore, so a new test case cannot be produced.Steps to reproduce
general::banners
PRISMIC_CUSTOM_TYPES_API_TOKEN
to generate from the repositoryWhat is expected?
Valid TypeScript type defintiions, where fields containing colons are escaped as strings, e.g.
What is actually happening?
Invalid syntax is generated, as these keys are not safely escaped.