Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-generated Types w/ Non-standard Naming #12

Open
Phylodome opened this issue Nov 28, 2019 · 1 comment
Open

Auto-generated Types w/ Non-standard Naming #12

Phylodome opened this issue Nov 28, 2019 · 1 comment

Comments

@Phylodome
Copy link

Phylodome commented Nov 28, 2019

When I attempt to run the codegen, I get:

  ✔ Parse configuration
  ❯ Generate outputs
    ❯ Generate src/types/Graphql.re
      ✔ Load GraphQL schemas
      ✔ Load GraphQL documents
      ✖ Generate
        → Module names must start with an uppercase letter.
    ✔ Generate src/types/Apollo.re

I'm pretty sure this is due to the fact that the codegen is attempting to create a module using type names that are auto-generated by neo4j-graphql-js, some of which begin w/ an underscore.

For example:

type _AddArtifactAttractorPayload {
  from: Attractor
  to: Artifact
}

Of course, direct conversion of these type names into module names doesn't play nicely w/ Ocaml's module naming conventions.

Would it be possible to allow users of this lib to specify a prefix regex to strip from module names, or some kind of transform function through which to run type names when converting them to modules?

@Phylodome
Copy link
Author

Just tried to bypass this via direct removal of the leading underscores in the generated introspection query, just to see if I could make some progress, then ran into:

  ✔ Parse configuration
  ❯ Generate outputs
    ❯ Generate src/types/Graphql.re
      ✔ Load GraphQL schemas
      ✔ Load GraphQL documents
      ✖ Generate
        → 1685: <syntax error>
    ✔ Generate src/types/Apollo.re


 Found 1 error

  ✖ src/types/Graphql.re

But because the lib doesn't seem to keep the generated file around if it errors out, this syntax error is entirely opaque to me 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant