Skip to content

Commit

Permalink
chore: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hantsy committed Nov 25, 2024
1 parent 6a200a6 commit 4a09159
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.netflix.graphql.dgs.DgsDirective;
import graphql.schema.DataFetcherFactories;
import graphql.schema.FieldCoordinates;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.idl.SchemaDirectiveWiring;
import graphql.schema.idl.SchemaDirectiveWiringEnvironment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@DgsDirective(name = "uppercase")
@Slf4j
Expand All @@ -16,8 +16,8 @@ public GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment<GraphQLFi

var field = env.getElement();
var parentType = env.getFieldsContainer();

var originalDataFetcher = env.getCodeRegistry().getDataFetcher(parentType, field);
var fieldCoordinates = FieldCoordinates.coordinates(parentType, field.getName());
var originalDataFetcher = env.getCodeRegistry().getDataFetcher(fieldCoordinates, field);
var dataFetcher = DataFetcherFactories.wrapDataFetcher(
originalDataFetcher,
(dataFetchingEnvironment, value) -> {
Expand All @@ -29,7 +29,7 @@ public GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment<GraphQLFi
}
);

env.getCodeRegistry().dataFetcher(parentType, field, dataFetcher);
env.getCodeRegistry().dataFetcher(fieldCoordinates, dataFetcher);
return field;
}
}

0 comments on commit 4a09159

Please sign in to comment.