@Override protected void handleEnumError(Value value, GraphQLEnumType type) { errorMessage = "is not a valid '%s'"; arguments.add(type.getName()); argumentValue = value; }
private TypePrinter<GraphQLEnumType> enumPrinter() { return (out, type, visibility) -> { if (isIntrospectionType(type)) { return; } printComments(out, type, ""); out.format("enum %s%s {\n", type.getName(), directivesString(type.getDirectives())); List<GraphQLEnumValueDefinition> values = type.getValues() .stream() .sorted(Comparator.comparing(GraphQLEnumValueDefinition::getName)) .collect(toList()); for (GraphQLEnumValueDefinition enumValueDefinition : values) { printComments(out, enumValueDefinition, " "); out.format(" %s%s\n", enumValueDefinition.getName(), directivesString(enumValueDefinition.getDirectives())); } out.format("}\n\n"); }; }
@Override public TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLType> context) { assertTypeUniqueness(node, result); save(node.getName(), node); return super.visitGraphQLEnumType(node, context); }
public Builder(GraphQLEnumType existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.definition = existing.getDefinition(); this.values.putAll(getByName(existing.getValues(), GraphQLEnumValueDefinition::getName)); this.directives.putAll(getByName(existing.getDirectives(), GraphQLDirective::getName)); }
@Override protected void handleEnumError(Value value, GraphQLEnumType type) { errorMessage = "is not a valid '%s'"; arguments.add(type.getName()); argumentValue = value; }
@Override public TraversalControl visitGraphQLEnumType(GraphQLEnumType node, TraverserContext<GraphQLType> context) { assertTypeUniqueness(node, result); save(node.getName(), node); return super.visitGraphQLEnumType(node, context); }
public Builder(GraphQLEnumType existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.definition = existing.getDefinition(); this.values.putAll(getByName(existing.getValues(), GraphQLEnumValueDefinition::getName)); this.directives.putAll(getByName(existing.getDirectives(), GraphQLDirective::getName)); }
private TypePrinter<GraphQLEnumType> enumPrinter() { return (out, type, visibility) -> { if (isIntrospectionType(type)) { return; } SchemaPrinterComparatorEnvironment environment = SchemaPrinterComparatorEnvironment.newEnvironment() .parentType(GraphQLEnumType.class) .elementType(GraphQLEnumValueDefinition.class) .build(); Comparator<? super GraphQLType> comparator = options.comparatorRegistry.getComparator(environment); printComments(out, type, ""); out.format("enum %s%s {\n", type.getName(), directivesString(GraphQLEnumType.class, type.getDirectives())); List<GraphQLEnumValueDefinition> values = type.getValues() .stream() .sorted(comparator) .collect(toList()); for (GraphQLEnumValueDefinition enumValueDefinition : values) { printComments(out, enumValueDefinition, " "); out.format(" %s%s\n", enumValueDefinition.getName(), directivesString(GraphQLEnumValueDefinition.class, enumValueDefinition.getDirectives())); } out.format("}\n\n"); }; }
private static GraphQLEnumType getEnum(final graphql.schema.GraphQLEnumType type){ final String name = type.getName(); if(REFUSED_OBJECT_TYPES.contains(name)){ return null; } final String id = generateId(); final GraphQLEnumType graphQLEnumType = new GraphQLEnumType(); graphQLEnumType.setId(id); graphQLEnumType.setName(name); graphQLEnumType.setDescription(type.getDescription()); for(EnumValueDefinition definition : type.getDefinition().getEnumValueDefinitions()){ GraphQLEnumValueDefinition enumValueDefinition = new GraphQLEnumValueDefinition(); enumValueDefinition.setName(definition.getName()); graphQLEnumType.getDefinitions().add(enumValueDefinition); } return graphQLEnumType; }