graphql-kit / graphql-lodash

🛠 Data manipulation for GraphQL queries with lodash syntax
https://apis.guru/graphql-lodash/
MIT License
1.23k stars 50 forks source link

Usage with "GraphQL Code Generator" #47

Open Alex-Ferreli opened 2 years ago

Alex-Ferreli commented 2 years ago

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?

IvanGoncharov commented 2 years ago

@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.

M-Matin-dev commented 2 years ago

It would be great to have this feature.

hutber commented 1 year ago

Ye, code gen is so fantastic!!

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

icdevin commented 1 year ago

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.

Alex-Ferreli commented 1 year ago

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?

icdevin commented 1 year ago

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.