-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add code generation for GraphQL enum & mutation input types #155
Conversation
Building this made me wonder if the API should be split off into a separate git repository and thus Go module from the CLI. This would remove the need for the go workspace change I made here but also be a cleaner separation of concerns to prevent bleed over into the API patterns to meet the needs of the CLI. |
@SaaldjorMike, one concern that I recall having about this PR is related to the backwards compatibility of the GraphQL API. If we generate this code and tie it to a specific CLI (or eventually API) release version then do we have guarantees that it will work for people running an older version of Logscale? Will we need to generate different releases of the generated API to match each stable Logscale release? |
@bderrly With #179 being merged in, we will from now on generate Go code from graphql queries/mutations based of the schema. This means that we going forward will be code-generating the Go code for interacting with the LogScale GraphQL API in https://github.com/humio/cli for things relevant to the humioctl tool, and separately within https://github.com/humio/humio-operator/ for things we need in that project. This is not limited to enums or input types. The most recent changes refactors how we interact with GraphQL for the
Right now the code path is as follows: https://github.com/humio/cli/tree/master/cmd/humioctl calls https://github.com/humio/cli/tree/master/internal/api which in turn calls the autogenerated code in https://github.com/humio/cli/blob/master/internal/api/humiographql/humiographql.go. |
I am glad to see the changes in #179! |
Add code genration for the input types and enumerations used on the Logscale GraphQL endpoint. The generation code is a modified version of that used in the https://github.com/shurcooL/graphql module.
I am looking for feedback on this as a path forward before I embark on the work to fully incorporate it and remove duplicate types already found in the CLI code.