public Builder(GraphQLArgument existing) { this.name = existing.getName(); this.type = existing.getType(); this.value = existing.getValue(); this.defaultValue = existing.getDefaultValue(); this.description = existing.getDescription(); this.definition = existing.getDefinition(); this.directives.putAll(FpKit.getByName(existing.getDirectives(), GraphQLDirective::getName)); }
private List<GraphQLArgument> transferMissingArguments(List<GraphQLArgument> arguments, GraphQLDirective directiveDefinition) { Map<String, GraphQLArgument> declaredArgs = FpKit.getByName(arguments, GraphQLArgument::getName, FpKit.mergeFirst()); List<GraphQLArgument> argumentsOut = new ArrayList<>(arguments); for (GraphQLArgument directiveDefArg : directiveDefinition.getArguments()) { if (!declaredArgs.containsKey(directiveDefArg.getName())) { GraphQLArgument missingArg = GraphQLArgument.newArgument() .name(directiveDefArg.getName()) .description(directiveDefArg.getDescription()) .definition(directiveDefArg.getDefinition()) .type(directiveDefArg.getType()) .defaultValue(directiveDefArg.getDefaultValue()) .value(directiveDefArg.getDefaultValue()) .build(); argumentsOut.add(missingArg); } } return argumentsOut; }
} else if (descriptionHolder instanceof GraphQLArgument) { GraphQLArgument type = (GraphQLArgument) descriptionHolder; return descriptionAndComments(type::getDescription, type::getDefinition, () -> type.getDefinition().getDescription()); } else { return Assert.assertShouldNeverHappen();
public Builder(GraphQLArgument existing) { this.name = existing.getName(); this.type = existing.getType(); this.value = existing.getValue(); this.defaultValue = existing.getDefaultValue(); this.description = existing.getDescription(); this.definition = existing.getDefinition(); this.directives.putAll(FpKit.getByName(existing.getDirectives(), GraphQLDirective::getName)); }
private List<GraphQLArgument> transferMissingArguments(List<GraphQLArgument> arguments, GraphQLDirective directiveDefinition) { Map<String, GraphQLArgument> declaredArgs = FpKit.getByName(arguments, GraphQLArgument::getName, FpKit.mergeFirst()); List<GraphQLArgument> argumentsOut = new ArrayList<>(arguments); for (GraphQLArgument directiveDefArg : directiveDefinition.getArguments()) { if (!declaredArgs.containsKey(directiveDefArg.getName())) { GraphQLArgument missingArg = GraphQLArgument.newArgument() .name(directiveDefArg.getName()) .description(directiveDefArg.getDescription()) .definition(directiveDefArg.getDefinition()) .type(directiveDefArg.getType()) .defaultValue(directiveDefArg.getDefaultValue()) .value(directiveDefArg.getDefaultValue()) .build(); argumentsOut.add(missingArg); } } return argumentsOut; }
public static GraphQLArgument.Builder notNull (GraphQLArgument.Builder aBuilder) { GraphQLArgument arg = aBuilder.build(); return GraphQLArgument.newArgument() .name(arg.getName()) .defaultValue(arg.getDefaultValue()) .definition(arg.getDefinition()) .description(arg.getDescription()) .type(new GraphQLNonNull(arg.getType())); }
} else if (descriptionHolder instanceof GraphQLArgument) { GraphQLArgument type = (GraphQLArgument) descriptionHolder; return descriptionAndComments(type::getDescription, type::getDefinition, () -> type.getDefinition().getDescription()); } else { return Assert.assertShouldNeverHappen();