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); }
protected Directive createDirective(GraphqlParser.DirectiveContext ctx) { Directive.Builder builder = Directive.newDirective(); builder.name(ctx.name().getText()); addCommonData(builder, ctx); builder.arguments(createArguments(ctx.arguments())); return builder.build(); }
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); }
protected Directive createDirective(GraphqlParser.DirectiveContext ctx) { Directive.Builder builder = Directive.newDirective(); builder.name(ctx.name().getText()); addCommonData(builder, ctx); builder.arguments(createArguments(ctx.arguments())); return builder.build(); }