Search in sources :

Example 11 with Value

use of graphql.language.Value in project graphql-java by graphql-java.

the class IntrospectionResultToSchema method createInputValueDefinitions.

@SuppressWarnings("unchecked")
private List<InputValueDefinition> createInputValueDefinitions(List<Map<String, Object>> args) {
    List<InputValueDefinition> result = new ArrayList<>();
    for (Map<String, Object> arg : args) {
        Type argType = createTypeIndirection((Map<String, Object>) arg.get("type"));
        InputValueDefinition inputValueDefinition = new InputValueDefinition((String) arg.get("name"), argType);
        inputValueDefinition.setComments(toComment((String) arg.get("description")));
        String valueLiteral = (String) arg.get("defaultValue");
        if (valueLiteral != null) {
            Value defaultValue = AstValueHelper.valueFromAst(valueLiteral);
            inputValueDefinition.setDefaultValue(defaultValue);
        }
        result.add(inputValueDefinition);
    }
    return result;
}
Also used : Type(graphql.language.Type) NonNullType(graphql.language.NonNullType) ListType(graphql.language.ListType) ArrayList(java.util.ArrayList) Value(graphql.language.Value) StringValue(graphql.language.StringValue) InputValueDefinition(graphql.language.InputValueDefinition)

Aggregations

Value (graphql.language.Value)11 ObjectValue (graphql.language.ObjectValue)6 ArrayValue (graphql.language.ArrayValue)4 StringValue (graphql.language.StringValue)4 Argument (graphql.language.Argument)3 BooleanValue (graphql.language.BooleanValue)3 IntValue (graphql.language.IntValue)3 NullValue (graphql.language.NullValue)3 Type (graphql.language.Type)2 VariableDefinition (graphql.language.VariableDefinition)2 GraphQLInputObjectField (graphql.schema.GraphQLInputObjectField)2 GraphQLInputType (graphql.schema.GraphQLInputType)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 PropertyKey (org.structr.core.property.PropertyKey)2 Directive (graphql.language.Directive)1 EnumValue (graphql.language.EnumValue)1 FloatValue (graphql.language.FloatValue)1 InputValueDefinition (graphql.language.InputValueDefinition)1 ListType (graphql.language.ListType)1