Closed AkezhanOb1 closed 5 years ago
have Mutation(context.Context, *"github.com/Username/user-name/vendor/github.com/vektah/gqlparser/ast".OperationDefinition) *"github.com/Username/user-name/vendor/github.com/99designs/gqlgen/graphql".Response
want Mutation(context.Context, *"github.com/vektah/gqlparser/ast".OperationDefinition)
This happens when you mix vendored and non vendored code, you've got to go all in on vendor, or all in on go get (and make sure you prune any vendor directories you might have)
@vektah @AkezhanOb1, I faced the same problem, How can i fix it?
it only happened after i go get -u ./...
, and only happened on gqlgen version: v0.11.2
api/graphql/generated.go:24:9: cannot use &executableSchema literal (type *executableSchema) as type graphql.ExecutableSchema in return argument:
*executableSchema does not implement graphql.ExecutableSchema (missing Exec method)
api/graphql/generated.go:583:11: ec.RequestMiddleware undefined (type executionContext has no field or method RequestMiddleware)
api/graphql/generated.go:592:17: ec.Errors undefined (type executionContext has no field or method Errors)
api/graphql/generated.go:593:17: ec.Extensions undefined (type executionContext has no field or method Extensions)
api/graphql/generated.go:600:11: ec.RequestMiddleware undefined (type executionContext has no field or method RequestMiddleware)
api/graphql/generated.go:609:17: ec.Errors undefined (type executionContext has no field or method Errors)
api/graphql/generated.go:610:17: ec.Extensions undefined (type executionContext has no field or method Extensions)
api/graphql/generated.go:615:24: cannot use graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported")) (type graphql.ResponseHandler) as type func() *graphql.Response in return argument
api/graphql/generated.go:627:33: cannot use parsedSchema (type *"github.com/vektah/gqlparser/ast".Schema) as type *"github.com/vektah/gqlparser/v2/ast".Schema in argument to introspection.WrapSchema
api/graphql/generated.go:634:38: cannot use parsedSchema (type *"github.com/vektah/gqlparser/ast".Schema) as type *"github.com/vektah/gqlparser/v2/ast".Schema in argument to introspection.WrapTypeFromDef
api/graphql/generated.go:634:38: too many errors
Facing the exact same problem after doing an update! Any way fix this?
If it helps anyone, I had to change the version to 0.10.1 (in mod file) and the errors are gone
@WLun001 , @cghorai were able to solve without locking to 0.10.1
?
Expected Behaviour
In the prev version of gqlgen everything was fine and worked great but after release, it does not work
Actual Behavior
When I run my code on local machine it works but when I start to build dockerfile it throws an error
graphTry/server/server.go:22:68: cannot use graphTry.NewExecutableSchema(graphTry.Config literal) (type "github.com/USERNAME/user-name/vendor/github.com/99designs/gqlgen/graphql".ExecutableSchema) as type "github.com/99designs/gqlgen/graphql".ExecutableSchema in argument to handler.GraphQL: "github.com/Username/user-name/vendor/github.com/99designs/gqlgen/graphql".ExecutableSchema does not implement "github.com/99designs/gqlgen/graphql".ExecutableSchema (wrong type for Mutation method) have Mutation(context.Context, *"github.com/Username/user-name/vendor/github.com/vektah/gqlparser/ast".OperationDefinition) *"github.com/Username/user-name/vendor/github.com/99designs/gqlgen/graphql".Response want Mutation(context.Context, *"github.com/vektah/gqlparser/ast".OperationDefinition) *"github.com/99designs/gqlgen/graphql".Response
my main file looks like this ` package main
and my dockerfile
`FROM golang:1.10.2-alpine3.7 AS build RUN apk --no-cache add gcc g++ make ca-certificates
WORKDIR /home/username/go/src/Stack/overflow/finance RUN ls RUN pwd COPY . . RUN pwd
RUN apk update && apk add git RUN go get github.com/golang/protobuf/jsonpb RUN go get github.com/golang/protobuf/proto RUN go get github.com/lib/pq RUN go get github.com/twitchtv/twirp RUN go get github.com/twitchtv/twirp/ctxsetters
RUN go get github.com/99designs/gqlgen/graphql RUN go get github.com/99designs/gqlgen/graphql/introspection RUN go get github.com/vektah/gqlparser RUN go get github.com/vektah/gqlparser/ast RUN go get github.com/99designs/gqlgen/cmd RUN go get github.com/99designs/gqlgen/handler RUN go get github.com/Username/user-name/server RUN go get github.com/Username/user-name/rpc/finance RUN go get github.com/Username/user-name/graphTry
RUN go get github.com/go-chi/chi RUN go get github.com/rs/cors RUN go get github.com/vektah/gqlparser
RUN go build -o /go/bin/stackexample ./graphTry/server/server.go
FROM alpine:3.7 as final WORKDIR /usr/bin COPY --from=build /go/bin . EXPOSE 8080 CMD ["./stackexample"]`
Minimal graphql.schema and models to reproduce