Giter Club home page Giter Club logo

graphql-codegen-reason's Issues

Duplicate "graphql" modules cannot be used at the same time

Current Version of @graphql-codegen/cli does not work and will present the following on generating:

Found 1 error

  ✖ src/GraphQLTypes.re
    Error: Cannot use GraphQLDirective "@include" from another module or realm.

    Ensure that there is only one instance of "graphql" in the node_modules
    directory. If different versions of "graphql" are the dependencies of other
    relied on modules, use "resolutions" to ensure only one version is installed.

    https://yarnpkg.com/en/docs/selective-version-resolutions

    Duplicate "graphql" modules cannot be used at the same time since different
    versions may have different capabilities and behavior. The data from one
    version used in the function from another could produce confusing and
    spurious results.

It looks like version 1.5.0 of codegen now uses "graphql": "^15.5.0", which is resulting in this error.

Update exceptions to be more meaningful

Currently if there's an issue with decoding the JSON, I'm Js.loging the problem and throwing a generic Not_found exception. It'd be better to have a specific exception that gets thrown with better error messages.

`Node` type

I tried running your project against the swapi-graphql schema. The schema and output can be see here: https://github.com/idkjs/graphql-codegen-reason/tree/master/tester. Side note: Only way I could get this to run is to run it on your master repo and switching out the schema. Installing the codegen per the instructions did not work for me. Probably just to thick in the head to understand your readme, but none the less.

Is this a bug or not an intended use case? Thanks for the feedback.

Running the codegen produces the following error:

>>>> Finish compiling(exit: 1)
>>>> Start compiling
[1/1] Building tester/generated/GraphQLTypes-GqlToReasonTester.cmj

  We've found a bug for you!
  /Users/prisc_000/working/graphql-codegen-reason-fork/tester/generated/GraphQLTypes.re 664:29-32

  662 │   let vehicle: field(t, option(vehicle)) =
  663 │     getNullableField(~fieldName="vehicle", ~typename);
  664 │   let node: field(t, option(node)) =
  665 │     getNullableField(~fieldName="node", ~typename);
  666 │ };

  This type constructor's parameter, `node`, can't be found. Is it a typo?

>>>> Finish compiling(exit: 1)

Error Reformatting

Ran some random schemas to check it out. Great project, sir. Kept trying stuff until I got an error. Finally got one with this SpaceX schema

Steps:

  1. Generate the schema with npx fetch-graphql-schema https://yv004pqnq9.sse.codesandbox.io/graphql -o schema.graphql -r
schema: ./schema.graphql
generates:
  GraphQLTypes3.re:
    plugins:
      - reason-client
    config:
      scalars:
        "DateTime": "string"

Run: [master*]node_modules/.bin/gql-gen

Output.

server [master*]node_modules/.bin/gql-gen
  ✔ Parse configuration
  ❯ Generate outputs
    ❯ Generate GraphQLTypes3.re
      ✔ Load GraphQL schemas
      ✔ Load GraphQL documents
      ✖ Generate
        → 1685: <syntax error>


  Found 1 error

   ✖ GraphQLTypes3.re
    [object Object]

How do we render that object object so we can chase it down?

schema.graphql gist

Thanks. And thanks for sharing.

Provide an option for running refmt on the generated output

Currently the plugin isn't running refmt after generating the string, because it makes it harder to deal with any errors in the output.

This was helpful during development, but in most scenarios we probably want to make sure we actually format the code - we'll add an option to not run it for scenarios where it might be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.