-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraphQL Field level context and error event on blocking fixes
Signed-off-by: Phillip Kruger <[email protected]>
- Loading branch information
1 parent
36ea30a
commit fa2424f
Showing
6 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ain/java/io/quarkus/smallrye/graphql/runtime/spi/datafetcher/QuarkusFieldDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.quarkus.smallrye.graphql.runtime.spi.datafetcher; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
import io.quarkus.arc.Arc; | ||
import io.quarkus.arc.ManagedContext; | ||
import io.smallrye.graphql.execution.datafetcher.FieldDataFetcher; | ||
import io.smallrye.graphql.schema.model.Field; | ||
import io.smallrye.graphql.schema.model.Reference; | ||
import io.smallrye.graphql.schema.model.Type; | ||
|
||
public class QuarkusFieldDataFetcher<T> extends FieldDataFetcher<T> { | ||
|
||
public QuarkusFieldDataFetcher(final Field field, final Type type, final Reference owner) { | ||
super(field, type, owner); | ||
} | ||
|
||
@Override | ||
public T get(DataFetchingEnvironment dfe) throws Exception { | ||
ManagedContext requestContext = Arc.container().requestContext(); | ||
try { | ||
RequestContextHelper.reactivate(requestContext, dfe); | ||
return super.get(dfe); | ||
} finally { | ||
requestContext.deactivate(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters