Getting resolver redeclared in this block
#1821
Replies: 3 comments
-
Edit: I solved it for my situation. Leaving this if you're stuck in the same situation: Note that with So, given the following schema definitions:
gqlgen will generate 2 files with resolver stubs: Depending on how you look at this, it might be considered either a bug (if you read the config as "generate my resolvers as follows") or desired behaviour (if you read the config as "all resolvers must be in these files). Old commentI am facing the same issue. Even if I copy the generated resolvers directly into a new user_resolver.go, it regenerates the stub resolvers on the next try and gives me:
relevant gqlgen configuration:
gqlgen version: |
Beta Was this translation helpful? Give feedback.
-
@HectorMalot how about the queries and mutations? Did you found a solution? |
Beta Was this translation helpful? Give feedback.
-
@Igorpollo, if you've defined them in If I find some time, I might open a PR to improve documentation on the |
Beta Was this translation helpful? Give feedback.
-
What happened?
I am building a GraphQL server to test gqlgen, all the code is in this public repo https://gitlab.com/tlenexkoyotl/gql-golang-demo/ and it includes instructions for every step I've taken through this test.
I separated my
schema.resolvers
into separate files (mutationResolver.go
,queryResolver.go
,userResolver.go
,meetupResolver.go
) as you can see, since a tutorial I'm following does so as a good practice.But regenerating gqlgen's boilerplate code with
go run github.com/99designs/gqlgen
results in a bunch ofresolver redeclared in this block
errors.What did you expect?
In the tutorial, whenever
go run github.com/99designs/gqlgen
is ran again to regenerate boilerplate code, it does not copy all implemented resolvers back into theresolver.go
file, only generates new code. I would expect the same to happen in my project.Minimal graphql.schema and models to reproduce
versions
gqlgen version
? I have triedv0.12.2
andv0.13.0
, both present the same issue (the tutorial usedv0.10.2
)go version
? Go1.15
Beta Was this translation helpful? Give feedback.
All reactions