You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to have a hook on @deprecated directive at runtime. So I added skip_runtime: false option for this directive. This led to error during validation:
validation failed: packages.Load: graph/generated.go:661:21: ec.directives.Deprecated undefined (type DirectiveRoot has no field or method Deprecated)
graph/generated.go:664:25: ec.directives.Deprecated undefined (type DirectiveRoot has no field or method Deprecated)
exit status 1
I've used steps from Getting Started for reproduction but with the following changes:
gqlgen.yml
# Where are all the schema files located? globs are supported eg src/**/*.graphqlsschema:
- graph/*.graphqls# Where should the generated server code go?exec:
filename: graph/generated.gopackage: graph# Uncomment to enable federation# federation:# filename: graph/federation.go# package: graphdirectives:
deprecated:
skip_runtime: false# Where should any generated models go?model:
filename: graph/model/models_gen.gopackage: model# Where should the resolver implementations go?resolver:
layout: follow-schemadir: graphpackage: graph# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models# struct_tag: json# Optional: turn on to use []Thing instead of []*Thing# omit_slice_element_pointers: false# Optional: turn off to make struct-type struct fields not use pointers# e.g. type Thing struct { FieldA OtherThing } instead of { FieldA *OtherThing }# struct_fields_always_pointers: true# Optional: turn off to make resolvers return values instead of pointers for structs# resolvers_always_return_pointers: true# Optional: set to speed up generation time by not performing a final validation pass.# skip_validation: true# gqlgen will search for any type names in the schema in these go packages# if they match it will use them, otherwise it will generate them.autobind:
# - "test/graph/model"# This section declares type mapping between the GraphQL and go type systems## The first line in each type will be used as defaults for resolver arguments and# modelgen, the others will be allowed when binding to fields. Configure them to# your likingmodels:
ID:
model:
- github.com/99designs/gqlgen/graphql.ID
- github.com/99designs/gqlgen/graphql.Int
- github.com/99designs/gqlgen/graphql.Int64
- github.com/99designs/gqlgen/graphql.Int32Int:
model:
- github.com/99designs/gqlgen/graphql.Int
- github.com/99designs/gqlgen/graphql.Int64
- github.com/99designs/gqlgen/graphql.Int32
graph/schema.graphqls
# GraphQL schema example
#
# https://gqlgen.com/getting-started/
type Todo {
id: ID!
text: String!
done: Boolean! @deprecated(reason: "for test")
user: User!
}
type User {
id: ID!# GraphQL schema example
#
# https://gqlgen.com/getting-started/
type Todo {
id: ID!
text: String!
done: Boolean! @deprecated(reason: "for test")
user: User!
}
type User {
id: ID!
name: String!
}
type Query {
todos: [Todo!]!
}
input NewTodo {
text: String!
userId: String!
}
type Mutation {
createTodo(input: NewTodo!): Todo!
}
name: String!
}
type Query {
todos: [Todo!]!
}
input NewTodo {
text: String!
userId: String!
}
type Mutation {
createTodo(input: NewTodo!): Todo!
}
versions
go run github.com/99designs/gqlgen version v0.17.25
go version go1.19.5 darwin/arm64
The text was updated successfully, but these errors were encountered:
What happened?
I wanted to have a hook on
@deprecated
directive at runtime. So I addedskip_runtime: false
option for this directive. This led to error during validation:What did you expect?
It was expected
Deprecated
field to be generated inDirectiveRoot
structure, but it was filtered out byfunc (d *Data) Directives() [DirectiveList
.Minimal graphql.schema and models to reproduce
I've used steps from Getting Started for reproduction but with the following changes:
gqlgen.yml
graph/schema.graphqls
versions
go run github.com/99designs/gqlgen version
v0.17.25go version
go1.19.5 darwin/arm64The text was updated successfully, but these errors were encountered: