private static void DeclareArguments( IDirectiveTypeDescriptor typeDescriptor, DirectiveDefinitionNode node) { foreach (InputValueDefinitionNode inputField in node.Arguments) { IDirectiveArgumentDescriptor descriptor = typeDescriptor .Argument(inputField.Name.Value) .Description(inputField.Description?.Value) .Type(inputField.Type) .SyntaxNode(inputField); if (inputField.DefaultValue is { })
/// <summary> /// Specifies the type of a directive argument with GraphQL SDL type syntax. /// </summary> /// <param name="descriptor"> /// The directive argument descriptor. /// </param> /// <param name="typeSyntax"> /// The GraphQL SDL type syntax. /// </param> /// <returns> /// Returns the directive 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 IDirectiveArgumentDescriptor Type( this IDirectiveArgumentDescriptor 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))); }