Schema directives currently only support built in scalars, are there any plans to add support for enums or any reason I shouldn't take a crack at adding them?
|
/** |
|
* We support the basic types as directive types |
|
* |
|
* @param value the value to use |
|
* |
|
* @return a graphql input type |
|
*/ |
|
public GraphQLInputType buildDirectiveInputType(Value value) { |
|
if (value instanceof NullValue) { |
|
return Scalars.GraphQLString; |
|
} |
|
if (value instanceof FloatValue) { |
|
return Scalars.GraphQLFloat; |
|
} |
|
if (value instanceof StringValue) { |
|
return Scalars.GraphQLString; |
|
} |
|
if (value instanceof IntValue) { |
|
return Scalars.GraphQLInt; |
|
} |
|
if (value instanceof BooleanValue) { |
|
return Scalars.GraphQLBoolean; |
|
} |
|
if (value instanceof ArrayValue) { |
|
ArrayValue arrayValue = (ArrayValue) value; |
|
return list(buildDirectiveInputType(getArrayValueWrappedType(arrayValue))); |
|
} |
|
return assertShouldNeverHappen("Directive values of type '%s' are not supported yet", value.getClass().getSimpleName()); |
|
} |
Schema directives currently only support built in scalars, are there any plans to add support for enums or any reason I shouldn't take a crack at adding them?
graphql-java/src/main/java/graphql/schema/idl/SchemaGeneratorHelper.java
Lines 155 to 183 in bd9240c