Skip to content

codegen doesn't protect against typenames which are typescript keywords #4887

Open
@cmcconomyfwig

Description

@cmcconomyfwig

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When generating a OData endpoint, I ran into an issue that one of the entities was called import.
This conflicts with an existing typescript keyword, and so the code caused errors.

an example snippet from the types.ts file:

  owner_imports?: Maybe<Array<Maybe<import>>>;
  owner_importsById?: Maybe<import>;

To Reproduce
Steps to reproduce the behavior:

(Can't give you access to this OData source)

Expected behavior

Code works as expected.
In order to avoid namespace collision, perhaps the mesh build step can create types with the name t__<name> instead?

Environment:

  • OS: MacOS
  • "@graphql-mesh/cli": "^0.80.4",
  • "@graphql-mesh/odata": "^0.20.35",
  • NodeJS: v16.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions