Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/graphql/schema/GraphQLEnumType.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
*/
@PublicApi
public class GraphQLEnumType implements GraphQLNamedDescriptionType, GraphQLNamedInputType, GraphQLNamedOutputType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLDirectiveContainer {


public static final GraphQLEnumType graphQLEnumType = newEnum().name("BUILT_IN").build();
private final String name;
private final String description;
private final Map<String, GraphQLEnumValueDefinition> valueDefinitionMap = new LinkedHashMap<>();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/graphql/schema/idl/SchemaGeneratorHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ public GraphQLInputType buildDirectiveInputType(Value value) {
ArrayValue arrayValue = (ArrayValue) value;
return list(buildDirectiveInputType(getArrayValueWrappedType(arrayValue)));
}
if (value instanceof EnumValue) {
return GraphQLEnumType.graphQLEnumType;
}
return assertShouldNeverHappen("Directive values of type '%s' are not supported yet", value.getClass().getSimpleName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import static graphql.Scalars.GraphQLBoolean
import static graphql.Scalars.GraphQLFloat
import static graphql.Scalars.GraphQLInt
import static graphql.Scalars.GraphQLString
import static graphql.schema.GraphQLEnumType.graphQLEnumType
import static graphql.schema.GraphQLList.list

class SchemaGeneratorTest extends Specification {
Expand Down Expand Up @@ -952,6 +953,7 @@ class SchemaGeneratorTest extends Specification {
"arrayNullsArg" | "[null, null]" || list(GraphQLString)
"arrayArg" | "[3,4,6]" || list(GraphQLInt)
"arrayWithNullsArg" | "[null,3,null,6]" || list(GraphQLInt)
"enumArg" | "MONDAY" || graphQLEnumType
}

@Unroll
Expand All @@ -974,7 +976,6 @@ class SchemaGeneratorTest extends Specification {
where:
argumentName | argumentValue || expectedErrorMessage
"objArg" | '{ hi: "John"}' || "Internal error: should never happen: Directive values of type 'ObjectValue' are not supported yet"
"enumArg" | "MONDAY" || "Internal error: should never happen: Directive values of type 'EnumValue' are not supported yet"
"polymorphicArrayArg" | '["one", { hi: "John"}, 5]' || "Arrays containing multiple types of values are not supported yet. Detected the following types [IntValue,ObjectValue,StringValue]"
}

Expand Down