gqlgen - DirectiveResolver not exported by package generated
Asked Answered
H

1

8

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

Hibbitts answered 16/4, 2021 at 12:10 Comment(1)
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: trueFurthermore
H
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.

Highpriced answered 20/4, 2021 at 22:26 Comment(1)
Worked for me, thanks! Any idea about why this happens in the first place, or when they're going to fix this?Chow

© 2022 - 2024 — McMap. All rights reserved.