/// <summary> /// Specifies the type of an argument with GraphQL SDL type syntax. /// </summary> /// <param name="descriptor"> /// The argument descriptor. /// </param> /// <param name="typeSyntax"> /// The GraphQL SDL type syntax. /// </param> /// <returns> /// Returns the argument descriptor for configuration chaining. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="descriptor"/> is <c>null</c>. /// <paramref name="typeSyntax"/> is <c>null</c>. /// </exception> /// <exception cref="SyntaxException"> /// The GraphQL SDL type syntax is invalid. /// </exception> public static IArgumentDescriptor Type( this IArgumentDescriptor descriptor, string typeSyntax) { if (descriptor is null) { throw new ArgumentNullException(nameof(descriptor)); } if (typeSyntax is null) { throw new ArgumentNullException(nameof(typeSyntax)); } return(descriptor.Type(Utf8GraphQLParser.Syntax.ParseTypeReference(typeSyntax))); }
public static IArgumentDescriptor Type <TInputType>(this IArgumentDescriptor descriptor, bool nullable) where TInputType : class, IInputType { return(nullable ? descriptor.Type <TInputType>() : descriptor.Type <NonNullType <TInputType> >()); }