graphql-lodash icon indicating copy to clipboard operation
graphql-lodash copied to clipboard

Usage with "GraphQL Code Generator"

Open Alex-Ferreli opened this issue 3 years ago • 6 comments

Hi, this plugin it's awesome! I'm able to get it working with @apollo/client with a custom ApolloLink as suggested in documentation.

It's also possible to make GraphQL Code Generator generate right types? I'm using it to generate Typescript types and React Hooks.

typescript-operations is the plugin that generate types, maybe should be possible to pass graphql-lodash custom directives and use them to generate right the types.

Some advice on how to do it?

Alex-Ferreli avatar Sep 19 '21 22:09 Alex-Ferreli

@Alex-Ferreli This is an experimental plugin, so I don't expect tools like "GraphQL Code Generator" supporting. Personally never used "GraphQL Code Generator" myself so can't offer help or advice. I Will keep this issue open so maybe someone from the community can help you.

IvanGoncharov avatar Sep 21 '21 12:09 IvanGoncharov

It would be great to have this feature.

M-Matin-dev avatar Feb 18 '22 10:02 M-Matin-dev

Ye, code gen is so fantastic!!

I wonder what would be needed to get this plugin out of experimental and into "YE BOI!!"

hutber avatar Aug 16 '22 07:08 hutber

GraphQL Codegen allows you to specify a custom loader which returns the schema. You can extend the schema before returning it from the custom loader.

icdevin avatar Nov 02 '22 03:11 icdevin

GraphQL Codegen allows you to specify a custom loader which returns the schema. You can extend the schema before returning it from the custom loader.

I can't edit my schema, it's autogenerated (by Hasura in this case). How can i add those custom directives to an existing schema? Could you provide an example please?

Alex-Ferreli avatar Nov 02 '22 09:11 Alex-Ferreli

Hasura looks like it's just a server-side tool. If your UI is using a schema generated by the server, there must be some point of introspection on the UI side where you can extend the schema returned from the server.

I have no experience with different GraphQL tools, I just know the ones I used, but I expect it's at least somewhat similar.

icdevin avatar Nov 02 '22 16:11 icdevin