• GraphQL.NET
  • Docs
  • GitHub

Query Validation

There are a number of query validation rules that are ran when a query is executed. All of these are turned on by default. You can add your own validation rules or clear out the existing ones by setting the ValidationRules property.

await schema.ExecuteAsync(_ =>
{
  _.Query = "...";
  _.ValidationRules =
    new[]
    {
      new RequiresAuthValidationRule()
    }
    .Concat(DocumentValidator.CoreRules);
});
Edit this page on GitHub
  • Getting Started
    • Introduction
    • Installation
    • GraphiQL
    • Altair GraphQL
    • Queries
    • Schema Types
    • Custom Scalars
    • Lists and Non-Null
    • Arguments
    • Aliases
    • Fragments
    • Variables
    • Directives
    • Mutations
    • Interfaces
    • Unions
    • Subscriptions
    • Transport
    • Query Validation
    • Query Organization
    • User Context
    • Error Handling
    • Dependency Injection
    • Databases
    • Malicious Queries
    • Object/Field Metadata
    • Field Middleware
    • Metrics
    • Authorization
    • Relay
    • Global Switches
  • Guides
    • Serialization
    • Dataloader
    • Schema Generation
    • Known Issues & FAQ
    • Links
    • Document Caching
  • Analyzers
    • Overview
    • GQL001
    • GQL002
    • GQL003
    • GQL004
    • GQL005
    • GQL006
    • GQL007
    • GQL008
    • GQL009
    • GQL011
  • Migration Guides
    • Migration Guide [v5 -> v7]
    • Migration Guide [v4 -> v5]
    • Migration Guide [v3 -> v4]
    • Migration Guide [v2 -> v3]
    • Migration Guide [v0.17.x -> v2]
    • Migration Guide [v0.11.0]
    • Migration Guide [v0.8.0]