-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Extract generated client queries #10195
Comments
Hi @jh-grundfos , Interesting! Could you please help me understand the behaviour by giving a small example of what the outcome would look like? For example, if I have these two queries, what would be the outcome? # src/User.graphql
query User {
user(id: "1") {
id
name
}
}
# src/Book.graphql
query Book {
book(id: "1") {
id
isbn
}
} |
Well, in my perfect world, you would be able to specify different output formats that could be expanded over time as new use cases emerge. At present time, I can see these being a good starting point:
The point of the JSON output format is flexibility, allowing users of the CLI to do what they want until the main CLI includes their use case. But allowing output to tools like Postman would enable the use of that whole toolchain it enables - mocking, testing, performance testing etc., while also making it more comfortable for users not familiar with GraphQL to query the server, as they then only have to input the query variables to get a response. |
To me, this is sounding less like the responsibility of Codegen CLI, and more like plugins: given a schema, the user can generate different targets using plugins. For example, it might look like this: generates: {
'src/postman': {
plugins: ['postman']
},
'src/insomnia': {
plugins: ['insomnia']
}
} You can look at the guide on how to write plugin here and look at our other community plugins in this repo |
Another use case would be to do query whitelisting in production, to avoid malicious actors to perform random queries of high complexity without permission. So essentially:
Apollo has a similar service, but I'd love it if Hive supported something similar, and this would allow us to build that ourselves EDIT: It would seem this plugin does the same for Hasura |
Hm, you may be right :) If the use case is wide enough and could provide extra value to the Hive product, is there any chance you/they could be interested in building the plugin? |
Our current focus is currently on improving support for the core GraphQL workflows e.g. with Client Preset, Server Preset, Federation support etc. |
Is your feature request related to a problem? Please describe.
Hey
I'm in need of a CLI or similar to extract all queries from a client app. The intended use is for mocking, testing and perhaps query whitelisting in production.
The Apollo CLI had this feature
https://github.com/apollographql/apollo-tooling/?tab=readme-ov-file#apollo-clientextract-output
However, that repo is actively being deprecated and is no longer maintainted, and not compatible with newer versions of Node.
I thought this might be something on your radar/roadmap as maintainers of
@graphql-codegen/cli
and@graphql-codegen/client-preset
?A button to export queries active on an environment on the Hive dashboard could also make sense, but maybe that request should be specifically made to the Hive team?
Describe the solution you'd like
A tool that extracts the queries in an app that uses
@graphql-codegen/cli
, preferably to a JSON output.Describe alternatives you've considered
https://github.com/apollographql/apollo-tooling/?tab=readme-ov-file#apollo-clientextract-output
Any additional important details?
No response
The text was updated successfully, but these errors were encountered: