Skip to content

Commit 6c69c93

Browse files
committed
Tweak code
1 parent 66f2829 commit 6c69c93

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/main/java/graphql/execution/ValuesResolverConversion.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,23 @@ static Object valueToInternalValueImpl(
130130
return inputValueWithState.getValue();
131131
}
132132
if (inputValueWithState.isLiteral()) {
133-
return literalToInternalValue(inputInterceptor, fieldVisibility, inputType, (Value<?>) inputValueWithState.getValue(), CoercedVariables.emptyVariables(), graphqlContext, locale);
133+
return literalToInternalValue(
134+
inputInterceptor,
135+
fieldVisibility,
136+
inputType,
137+
(Value<?>) inputValueWithState.getValue(),
138+
CoercedVariables.emptyVariables(),
139+
graphqlContext,
140+
locale);
134141
}
135142
if (inputValueWithState.isExternal()) {
136-
return externalValueToInternalValueImpl(inputInterceptor, fieldVisibility, inputType, inputValueWithState.getValue(), graphqlContext, locale);
143+
return externalValueToInternalValueImpl(
144+
inputInterceptor,
145+
fieldVisibility,
146+
inputType,
147+
inputValueWithState.getValue(),
148+
graphqlContext,
149+
locale);
137150
}
138151
return assertShouldNeverHappen("unexpected value state " + inputValueWithState);
139152
}

src/main/java/graphql/execution/values/InputInterceptor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
* This INTERNAL class can be used to intercept input values before they are coerced into runtime values
1313
* by the {@link graphql.execution.ValuesResolver} code.
1414
* <p>
15+
* You could use it to observe input values and optionally change them. Perhaps some sort of migration of data
16+
* needs to happen, and you need to know what data you are getting in type terms. This would help you do that.
17+
* <p>
1518
* If this is present in a {@link GraphQLContext} it will be called. By default, it is not present
1619
* so no calls to it will be made.
1720
* <p>
@@ -23,7 +26,7 @@ public interface InputInterceptor {
2326

2427
/**
2528
* This is called with a value that is to be presented to the {@link graphql.execution.ValuesResolver} code. The values
26-
* may be scalars, enums and complex input types. The values can be
29+
* may be scalars, enums and complex input types.
2730
*
2831
* @param value the input value that can be null
2932
* @param graphQLType the input type

0 commit comments

Comments
 (0)