Closed suyeon-jung-dev closed 1 month ago
@suyeon-jung-dev can you please confirm if you have tried running the gqlgen command and it's running fine? go run github.com/99designs/gqlgen generate
@suyeon-jung-dev can you please confirm if you have tried running the gqlgen command and it's running fine?
go run github.com/99designs/gqlgen generate
Hi @Saranya-jena
I refactored root types to Query and Mutation in chaos_experiment.graphqls
to ensure no changes during gqlgen build.
I've attached the gqlgen generate results below.
And, I'll include the changes in generated.go
.
I added generated.go
file as well.
And graphql server works well. I attached some logs from graphql server below.
{"body_size":116,"client_ip":"::1","error":"","file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/api/middleware/logger.go:60","func":"main.setupGin.DefaultStructuredLogger.StructuredLogger.func2","latency":"16.802833ms","level":"info","method":"POST","msg":"","path":"/query","status":200,"time":"2024-09-20T21:00:03+09:00"}
{"body_size":90,"client_ip":"::1","error":"","file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/api/middleware/logger.go:60","func":"main.setupGin.DefaultStructuredLogger.StructuredLogger.func2","latency":"16.807667ms","level":"info","method":"POST","msg":"","path":"/query","status":200,"time":"2024-09-20T21:00:03+09:00"}
{"file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/graph/environment.resolvers.go:20","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph.(*mutationResolver).CreateEnvironment","level":"info","msg":"request received to create new environment","projectId":"ef7f1c15-933c-4e2e-a44a-25d62da07649","time":"2024-09-20T21:00:27+09:00"}
{"body_size":259,"client_ip":"::1","error":"","file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/api/middleware/logger.go:60","func":"main.setupGin.DefaultStructuredLogger.StructuredLogger.func2","latency":"27.907791ms","level":"info","method":"POST","msg":"","path":"/query","status":200,"time":"2024-09-20T21:00:27+09:00"}
{"file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/graph/environment.resolvers.go:104","func":"github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph.(*queryResolver).ListEnvironments","level":"info","msg":"request received to list environments","projectId":"ef7f1c15-933c-4e2e-a44a-25d62da07649","time":"2024-09-20T21:00:27+09:00"}
{"body_size":458,"client_ip":"::1","error":"","file":"/Users/jeongsuyeon/IdeaProjects/suyeon-jung-dev/litmus/chaoscenter/graphql/server/api/middleware/logger.go:60","func":"main.setupGin.DefaultStructuredLogger.StructuredLogger.func2","latency":"21.589334ms","level":"info","method":"POST","msg":"","path":"/query","status":200,"time":"2024-09-20T21:00:27+09:00"}
Awesome thanks for confirming! 🚀
Proposed changes
I converted an extended operation type to a root type in the GraphQL schema for the following 3 reasons:
According to the GraphQL specification, a schema must define the root operation types for each kind of operation it supports: queries, mutations, and subscriptions. This implies that there must be a clear starting point for executing any operation in the schema.
I believe this change will ensure that our schema adheres to the GraphQL specifications, potentially improving compatibility and maintainability.
Resolve #4893
Types of changes
What types of changes does your code introduce to Litmus? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer: