private void createDeprecatedDirective(Map<String, Object> field, NodeDirectivesBuilder nodeDirectivesBuilder) { List<Directive> directives = new ArrayList<>(); if ((Boolean) field.get("isDeprecated")) { String reason = (String) field.get("deprecationReason"); if (reason == null) { reason = "No longer supported"; // default according to spec } Argument reasonArg = Argument.newArgument().name("reason").value(StringValue.newStringValue().value(reason).build()).build(); Directive deprecated = Directive.newDirective().name("deprecated").arguments(Collections.singletonList(reasonArg)).build(); directives.add(deprecated); } nodeDirectivesBuilder.directives(directives); }
private void createDeprecatedDirective(Map<String, Object> field, NodeDirectivesBuilder nodeDirectivesBuilder) { List<Directive> directives = new ArrayList<>(); if ((Boolean) field.get("isDeprecated")) { String reason = (String) field.get("deprecationReason"); if (reason == null) { reason = "No longer supported"; // default according to spec } Argument reasonArg = Argument.newArgument().name("reason").value(StringValue.newStringValue().value(reason).build()).build(); Directive deprecated = Directive.newDirective().name("deprecated").arguments(Collections.singletonList(reasonArg)).build(); directives.add(deprecated); } nodeDirectivesBuilder.directives(directives); }
public static Builder newArgument(String name, Value value) { return new Builder().name(name).value(value); }
protected Argument createArgument(GraphqlParser.ArgumentContext ctx) { Argument.Builder builder = Argument.newArgument(); addCommonData(builder, ctx); builder.name(ctx.name().getText()); builder.value(createValue(ctx.valueWithVariable())); return builder.build(); }
public static Builder newArgument(String name, Value value) { return new Builder().name(name).value(value); }
protected Argument createArgument(GraphqlParser.ArgumentContext ctx) { Argument.Builder builder = Argument.newArgument(); addCommonData(builder, ctx); builder.name(ctx.name().getText()); builder.value(createValue(ctx.valueWithVariable())); return builder.build(); }