private static void HandleFieldValue( HashSet <object> processed, Dictionary <string, IValueNode> fieldValues, InputField field, IInputType fieldType, object fieldValue) { if (fieldValue == null) { fieldValues[field.Name] = NullValueNode.Default; } else if (fieldType.IsNonNullType()) { HandleFieldValue(processed, fieldValues, field, (IInputType)fieldType.InnerType(), fieldValue); } else if (fieldType.IsListType()) { fieldValues[field.Name] = ParseList( processed, fieldType, fieldValue); } else if (fieldType.IsScalarType() || fieldType.IsEnumType()) { fieldValues[field.Name] = ParseScalar( fieldType, fieldValue); } else if (fieldType.IsInputObjectType() && !processed.Contains(fieldValue)) { fieldValues[field.Name] = ParseObject( processed, (InputObjectType)fieldType, fieldValue); } }
private static IValueNode ParseValue( HashSet <object> processed, IInputType inputType, object obj) { if (inputType.IsNonNullType()) { return(ParseValue(processed, (IInputType)inputType.InnerType(), obj)); } else if (inputType.IsListType()) { return(ParseList(processed, inputType, obj)); } else if (inputType.IsScalarType() || inputType.IsEnumType()) { return(ParseScalar(inputType, obj)); } else if (inputType.IsInputObjectType() && !processed.Contains(obj)) { return(ParseObject(processed, (InputObjectType)inputType, obj)); } else { return(NullValueNode.Default); } }
private object ParseLiteral(IInputType argumentType, IValueNode value) { IInputType type = (argumentType is NonNullType) ? (IInputType)argumentType.InnerType() : argumentType; return(type.ParseLiteral(value)); }