gqlgen icon indicating copy to clipboard operation
gqlgen copied to clipboard

Directives are ignored when using maps as changesets

Open pgeorgiadis opened this issue 3 years ago • 0 comments

What happened?

I have defined some directives on several fields on several input types as described here: https://gqlgen.com/reference/directives/ .

In my application I needed the functionality described here: https://gqlgen.com/reference/changesets/ . So I did override the model for some input types with map[string]interface{}.

In the generated code the calls that are related to the directives appear inside the func (ec *executionContext) unmarshalInputMyInputType(ctx context.Context, obj interface{}) (model.MyInputType, error) { function, which is never called and there is no way to trigger it manually.

What did you expect?

I would expect the code that is related to the directives to be independent from the unmarshal function and to still be triggeredor at least be able to call it manually inside my resolvers.

Minimal graphql.schema and models to reproduce

input MyInputType {
    foo: Float @rangeInt(min: 0, max: 10)
}

gqlgen.yml

models:
  MyInputType:
    model: "map[string]interface{}"

versions

  • gqlgen version: v0.14.0
  • go version: 1.17.2

pgeorgiadis avatar Jan 10 '22 12:01 pgeorgiadis