Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded the ability to instrument document and variables #1355
Conversation
|
see the comment about preventing mutations to variables |
| return document; | ||
| } | ||
|
|
||
| public Map<String, Object> getVariables() { |
andimarek
Dec 20, 2018
Member
return a new linkedhasmap here I would say
return a new linkedhasmap here I would say
tsroka
Dec 20, 2018
Member
I would say, return Collections.unmodifiableMap here, since this class is supposed to be immutable?
I would say, return Collections.unmodifiableMap here, since this class is supposed to be immutable?
andimarek
Dec 27, 2018
Member
I agree in theory both are valid options, but in graphql java we decided to return new copies everywhere.
I agree in theory both are valid options, but in graphql java we decided to return new copies everywhere.
bbakerman
Jan 8, 2019
Author
Member
fixed
fixed
| return new PreparsedDocumentEntry(toInvalidSyntaxError(parseResult.getException())); | ||
| } else { | ||
| final Document document = parseResult.getDocument(); | ||
| // they may have changed the document and the variables via instrumentation so update the reference to it | ||
| executionInput = executionInput.transform(builder -> builder.variables(parseResult.getVariables())); |
tsroka
Dec 20, 2018
Member
AFAIK any other instrumentation methods cannot change state. instrumentDocumentAndVariables feels inconsistent with the rest of Instrumentation interface. Should it not be a separate interface with Transformation in its name?
AFAIK any other instrumentation methods cannot change state. instrumentDocumentAndVariables feels inconsistent with the rest of Instrumentation interface. Should it not be a separate interface with Transformation in its name?
bbakerman
Jan 8, 2019
Author
Member
Actually we have 6 - instrumentExecutionInput, DocumentAndVariables, Schema, ExecutionContext, DataFetcher, and ExecutionResult
Actually we have 6 - instrumentExecutionInput, DocumentAndVariables, Schema, ExecutionContext, DataFetcher, and ExecutionResult
| return document; | ||
| } | ||
|
|
||
| public Map<String, Object> getVariables() { |
tsroka
Dec 20, 2018
Member
I would say, return Collections.unmodifiableMap here, since this class is supposed to be immutable?
I would say, return Collections.unmodifiableMap here, since this class is supposed to be immutable?
This tweaks the unreleased ability to instrument a Document and turns it into Document and variables