Skip to content

Adds a predicate mechanism to compile a document into all variables or just some - #2731

Merged
bbakerman merged 2 commits into
masterfrom
ast_compiler_with_predicate
Feb 22, 2022
Merged

bbakerman merged 2 commits into
masterfrom
ast_compiler_with_predicate

Conversation

@bbakerman

Copy link
Copy Markdown
Member

This moves the Nadel fixes back in graphql-java world

…r just some

This moves the Nadel fixes back in graphql-java world

private static String getVarName(int variableOrdinal) {
return "v" + variableOrdinal;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shortened the original work that Artyom put in as var_0 - I figure we should be as short as possible

@bbakerman bbakerman added this to the 18.0 milestone Feb 22, 2022
@bbakerman
bbakerman merged commit f55f455 into master Feb 22, 2022

@gnawf gnawf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shit I never pressed submit yesterday

* @return the map of variable names to variable values
*/
public Map<String, Object> getVariablesMap() {
return valueWithDefinitions.stream()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No immutable collections stuff?

* The {@link ExecutableNormalizedOperationToAstCompiler} then uses all the variables when it compiles the final document.
*/
@Internal
public class VariableAccumulator {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

/**
* This predicate indicates whether a variable should be made for this field argument
*/
@Internal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal?

@@ -0,0 +1,19 @@
package graphql.schema.scalars;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be under the test module?

@@ -0,0 +1,177 @@
package graphql.schema.scalars;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, test module?

// some values can be null (NullValue) and hence we can use Immutable Lists
return arrayValues.stream()
.map(ValueToVariableValueCompiler::toVariableValue)
.collect(toList());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you use FpKit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants