I am new to GraphQL, gqlgen library. Tried running go run github.com/99designs/gqlgen init
command but getting validation failed: packages.Load: C:\Users\Aylin\Desktop\gqlgen-tutorial\graph\prelude.resolvers.go:19:44: __DirectiveResolver not exported by package generated
error. This is the first step of the project setup and is not supposed to cause any errors. Anyone had the same problem and knows how to fix it? Thanks
Asked
Active
Viewed 3,154 times
8

Helen Grey
- 439
- 6
- 16
-
I have the same issue. `schema: - schema.graphql exec: filename: ../../src/http_app/gql/generated/generated.go package: generated model: filename: ../../src/model/models_gen.go package: model resolver: layout: follow-schema dir: ../../src/http_app/gql package: gql filename_template: "{name}.resolvers.go" type: Resolver autobind: - framegork/src/model omit_slice_element_pointers: true` – Anatolii Dev Apr 19 '21 at 15:10
1 Answers
14
I took this one and I've resolved it. Change version for "github.com/vektah/gqlparser/v2" in your go.mod file. From:
go 1.16
require (
github.com/99designs/gqlgen v0.13.0
github.com/vektah/gqlparser/v2 v2.2.0
)
To:
github.com/vektah/gqlparser/v2 v2.1.0
Delete prelude.resolvers.go after that.

FreezeLook
- 156
- 1
- 3
-
Worked for me, thanks! Any idea about why this happens in the first place, or when they're going to fix this? – Yoav Feuerstein Nov 14 '21 at 14:29