Sign in

    graphql

    GraphQL parsing, validation, execution, and native HTTP transport for MoonBit.

    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    2 hours ago
    Downloads
    1

    #moonbit-community/graphql

    GraphQL parser, validator, executor, subscription runtime, and small HTTP adapter for MoonBit. The root package focuses on building executable schemas from SDL and running GraphQL requests; the parser package exposes the AST, tokenizer, parser, formatter, and minifier for tooling; the http package wires an executable schema into moonbitlang/async/http.

    #Packages

    • moonbit-community/graphql: schema compilation, argument coercion, validation, execution, introspection, and subscription streams.
    • moonbit-community/graphql/parser: GraphQL query and schema parsing, formatting, minification, and token-level source positions.
    • moonbit-community/graphql/http: GET/POST handling, JSON batch requests, GraphiQL routing, and websocket subscription transport helpers.

    #Building a Schema

    Schemas are usually created from GraphQL SDL with SchemaBuilder::from_sdl. Register a resolver for every query and mutation root field, then call finish() to validate the executable schema.

    ///|
    let builder : SchemaBuilder[Unit] = SchemaBuilder::from_sdl(
    (
    #|type Query {
    #| hello(name: String = "world"): String!
    #|}
    ),
    )

    ///|
    let schema = builder
    .resolve("Query", "hello", async fn(_info, args, _ctx) {
    let name : String = args.get("name")
    GqlString("hello " + name)
    })
    .finish()

    Resolvers receive:

    • ResolveInfo: parent type, field name, response key, response path, and the source value being completed.
    • Args: coerced GraphQL arguments, with typed access through Args::get[T] and Args::get_opt[T].
    • user context: the generic Ctx value passed to execute.

    Object resolvers can return GqlObject values for simple objects or GqlTypedObject values when the runtime GraphQL type matters, such as interface and union selections. For untyped objects returned through an interface or union, register SchemaBuilder::resolve_type to choose and validate the concrete object type at execution time.

    #Executing Requests

    Use GraphQLRequest::new to provide a query, optional operation name, and variables. execute returns a GraphQLResponse; execute_with_status also returns the HTTP-oriented status code chosen by parse, validation, and coercion failures.

    ///|
    let response = execute(
    schema,
    GraphQLRequest::new("query SayHello($name: String!) { hello(name: $name) }", variables={
    "name": InputString("Ada"),
    }),
    (),
    )

    ///|
    let json = response.to_json()

    The executor validates the document before running resolvers, coerces variables and arguments against the schema, propagates non-null failures, and serializes the response using GraphQL's data and errors shape.

    #Parsing and Formatting

    The parser package can be used independently for GraphQL tooling.

    ///|
    let query = @parser.parse_query("query { viewer { id name } }")

    ///|
    let pretty = query.format()

    ///|
    let compact = @parser.minify_query(pretty)

    ///|
    let schema_doc = @parser.parse_schema("type Query { viewer: User }")

    ///|
    let sdl = schema_doc.format(style=@parser.Style::default().with_indent(2))

    All parser errors include a 1-based source line and column through ParseError. Tokens also retain byte offsets so editors and code generators can map AST data back to the original source.

    #HTTP Adapter

    The http package exposes serve for live async HTTP servers and handle_request for tests or custom routers. Defaults serve GraphQL at /graphql, a small GraphiQL page at /graphiql, and websocket subscriptions at /graphql.

    let config = @graphql_http.HttpConfig::default()
    @graphql_http.serve(server, schema, _request => (), config~)

    Supported request forms include:

    • GET /graphql?query=...&operationName=...&variables=...
    • POST /graphql with application/json
    • POST /graphql with application/graphql
    • JSON batch arrays for multiple operations in one request
    • websocket messages compatible with graphql-transport-ws subscribe and legacy start operations

    #Notes

    This project is intentionally small and close to the GraphQL specification. It currently includes the built-in scalar and directive definitions needed by the validator and executor, plus a minimal JSON-style introspection response for runtime and tooling use.

    Resolver

    type Resolver[Ctx] = async (ResolveInfo, Args, Ctx) -> GqlValue

    Async field resolver signature used by SchemaBuilder::resolve.

    SubscriptionResolver

    type SubscriptionResolver[Ctx] = async (ResolveInfo, Args, Ctx) -> SubscriptionStream

    Async subscription resolver signature used by SchemaBuilder::subscribe.

    TypeResolver

    type TypeResolver[Ctx] = async (String, GqlValue, Ctx) -> String

    Async resolver used to choose a concrete object type for an interface or union value that is not returned as GqlTypedObject.

    FromGraphQL

    pub(open) trait FromGraphQL {
    fn from_graphql(InputValue) -> Self raise CoercionError
    }

    Convert a coerced GraphQL input value into a MoonBit resolver argument type.
    impl FromGraphQL for Bool
    impl FromGraphQL for Int
    impl FromGraphQL for Option[T]
    impl FromGraphQL for Array[T]
    impl FromGraphQL for Json

    ToGraphQL

    pub(open) trait ToGraphQL {
    fn to_graphql(Self) -> GqlValue
    }

    Convert a MoonBit value into a resolver-facing GraphQL runtime value.
    impl ToGraphQL for Bool
    impl ToGraphQL for Int
    impl ToGraphQL for Int64
    impl ToGraphQL for Double
    impl ToGraphQL for String
    impl ToGraphQL for Option[T]
    impl ToGraphQL for Array[T]
    impl ToGraphQL for Json

    CoercionError

    pub(all) suberror CoercionError {
    CoercionError(String)
    } derive(Eq,
    Debug
    )

    Error raised when literal, variable, or resolver argument values cannot be coerced to the expected GraphQL input type.

    CoercionError::equal

    CoercionError::not_equal

    fn CoercionError::not_equal(x : CoercionError, y : CoercionError) -> Bool

    CoercionError::output

    fn CoercionError::output(self : CoercionError, logger : &Logger) -> Unit

    CoercionError::to_string

    fn CoercionError::to_string(self : CoercionError) -> String

    Render a coercion error with a stable GraphQL-oriented prefix.

    ExecutionError

    pub(all) suberror ExecutionError {
    ExecutionError(String)
    } derive(Eq,
    Debug
    )

    Error category for executor-specific failures.

    Resolver exceptions are captured as GraphQL response errors; this error type is available for executor helpers that need to raise explicitly.

    ExecutionError::equal

    ExecutionError::not_equal

    fn ExecutionError::not_equal(x : ExecutionError, y : ExecutionError) -> Bool

    ExecutionError::output

    fn ExecutionError::output(self : ExecutionError, logger : &Logger) -> Unit

    ExecutionError::to_string

    fn ExecutionError::to_string(self : ExecutionError) -> String

    Render an execution error with a stable GraphQL-oriented prefix.

    SchemaError

    pub(all) suberror SchemaError {
    SchemaError(String)
    } derive(Eq,
    Debug
    )

    Error raised while compiling SDL into an executable schema.

    Schema errors cover duplicate definitions, missing root types, invalid directive uses, and references to unknown input or output types.
    impl Show for SchemaError

    SchemaError::equal

    fn SchemaError::equal(SchemaError, SchemaError) -> Bool

    SchemaError::not_equal

    fn SchemaError::not_equal(x : SchemaError, y : SchemaError) -> Bool

    SchemaError::output

    fn SchemaError::output(self : SchemaError, logger : &Logger) -> Unit

    SchemaError::to_string

    fn SchemaError::to_string(self : SchemaError) -> String

    Render a schema error with a stable GraphQL-oriented prefix.

    ValidationError

    pub(all) suberror ValidationError {
    ValidationError(String)
    } derive(Eq,
    Debug
    )

    Error raised when a parsed GraphQL operation fails document validation.

    Validation runs before resolver execution and reports issues such as unknown fields, invalid fragments, unused variables, and directive misuse.

    ValidationError::equal

    ValidationError::not_equal

    fn ValidationError::not_equal(x : ValidationError, y : ValidationError) -> Bool

    ValidationError::output

    fn ValidationError::output(self : ValidationError, logger : &Logger) -> Unit

    ValidationError::to_string

    fn ValidationError::to_string(self : ValidationError) -> String

    Render a validation error with a stable GraphQL-oriented prefix.

    Args

    pub(all) struct Args {
    values : Map[String, InputValue]
    } derive(Eq,
    Debug
    )

    Coerced argument map passed to field and subscription resolvers.

    The executor builds Args after validating the request against the schema, applying GraphQL defaults, and converting variables into runtime input values. Prefer get and get_opt so custom scalar and list coercion goes through the FromGraphQL trait.

    Args::contains

    fn Args::contains(self : Args, name : String) -> Bool

    Test whether an argument was present after GraphQL defaulting and coercion.

    Args::empty

    fn Args::empty() -> Args

    Create an empty argument set for helpers and tests.

    Args::equal

    fn Args::equal(Args, Args) -> Bool

    Args::get

    fn[T : FromGraphQL] Args::get(self : Args, name : String) -> T raise CoercionError

    Read a required argument and coerce it to a MoonBit type.

    Raises CoercionError if the argument was not supplied or if the requested MoonBit type cannot be built from the GraphQL input value.

    Args::get_opt

    fn[T : FromGraphQL] Args::get_opt(self : Args, name : String) -> T? raise CoercionError

    Read an optional argument and coerce it when present.

    Missing arguments return None; present null values are delegated to the requested FromGraphQL implementation, so T? is the usual type for nullable GraphQL arguments.

    Args::not_equal

    fn Args::not_equal(x : Args, y : Args) -> Bool

    Args::to_map

    fn Args::to_map(self : Args) -> Map[String, InputValue]

    Return a copy of the underlying input map for custom coercion code.

    Args::to_repr

    DirectiveSpec

    pub(all) struct DirectiveSpec {
    name : String
    arguments : Array[
    InputValue
    ]
    locations : Array[String]
    repeatable : Bool
    } derive(Eq,
    Debug
    )

    Runtime description of a directive available in a compiled schema.

    DirectiveSpec::equal

    DirectiveSpec::not_equal

    fn DirectiveSpec::not_equal(x : DirectiveSpec, y : DirectiveSpec) -> Bool

    ExecutableSchema

    pub(all) struct ExecutableSchema[Ctx] {
    registry : TypeRegistry
    query_type : String
    mutation_type : String?
    subscription_type : String?
    resolvers : Map[String, async (ResolveInfo, Args, Ctx) -> GqlValue]
    subscriptions : Map[String, async (ResolveInfo, Args, Ctx) -> SubscriptionStream]
    type_resolvers : Map[String, async (String, GqlValue, Ctx) -> String]
    validation : ValidationConfig
    }

    Validated schema ready for execution.

    Construct values with SchemaBuilder::from_sdl(...).resolve(...).finish() so root resolver coverage and schema references are checked before use.

    ExecutableSchema::query_type

    fn[Ctx] ExecutableSchema::query_type(self : ExecutableSchema[Ctx]) -> String

    Return the GraphQL query root type name.

    ExecutableSchema::type_names

    fn[Ctx] ExecutableSchema::type_names(self : ExecutableSchema[Ctx]) -> Array[String]

    Return the names of all compiled types in the schema registry.

    ExecutionHttpResult

    pub(all) struct ExecutionHttpResult {
    status_code : Int
    response : GraphQLResponse
    } derive(Eq,
    Debug
    )

    HTTP-oriented execution result containing status code and GraphQL response.

    ExecutionHttpResult::equal

    ExecutionHttpResult::not_equal

    FieldDef

    Runtime field definition compiled from SDL.

    The executor uses arguments for coercion, field_type for completion and non-null bubbling, and directives for schema metadata.

    FieldDef::equal

    fn FieldDef::equal(FieldDef, FieldDef) -> Bool

    FieldDef::not_equal

    fn FieldDef::not_equal(x : FieldDef, y : FieldDef) -> Bool

    FieldDef::to_repr

    GqlValue

    pub(all) enum GqlValue {
    GqlNull
    GqlString(String)
    GqlBoolean(Bool)
    GqlInt(Int)
    GqlInt64(Int64)
    GqlFloat(Double)
    GqlEnum(String)
    GqlList(Array[GqlValue])
    GqlObject(Map[String, GqlValue])
    GqlTypedObject(String, Map[String, GqlValue])
    } derive(Eq,
    Debug
    )

    Runtime value returned by resolvers and completed into GraphQL response data.

    Use scalar variants for leaf fields, GqlObject for object-like values, and GqlTypedObject when interface or union completion needs an explicit runtime type.

    GqlValue::equal

    fn GqlValue::equal(GqlValue, GqlValue) -> Bool

    GqlValue::field

    fn GqlValue::field(self : GqlValue, name : String) -> GqlValue?

    Read a field from GqlObject or GqlTypedObject.

    The executor uses this as the default resolver when no explicit field resolver is registered.

    GqlValue::not_equal

    fn GqlValue::not_equal(x : GqlValue, y : GqlValue) -> Bool

    GqlValue::object

    fn GqlValue::object(fields : ArrayView[(String, GqlValue)]) -> GqlValue

    Construct an object value from a compact field array.

    GqlValue::runtime_type

    fn GqlValue::runtime_type(self : GqlValue, fallback~ : String) -> String

    Return the explicit runtime type carried by a typed object, or fallback.

    GqlValue::to_json

    fn GqlValue::to_json(self : GqlValue) -> Json

    Convert a completed GraphQL runtime value into JSON response data.

    GqlValue::to_repr

    GqlValue::typed_object

    fn GqlValue::typed_object(type_name : String, fields : ArrayView[(String, GqlValue)]) -> GqlValue

    Construct an object value with an explicit GraphQL runtime type.

    This is required when returning interface or union members whose concrete type cannot be inferred from the field's declared type.

    GraphQLError

    pub(all) struct GraphQLError {
    message : String
    path : Array[PathSegment]
    locations : Array[SourceLocation]
    } derive(Eq,
    Debug
    )

    GraphQL error entry with message, optional path, and optional source locations.

    GraphQLError::equal

    GraphQLError::new

    fn GraphQLError::new(message : String, path? : Array[PathSegment], locations? : Array[SourceLocation]) -> GraphQLError

    Create a GraphQL error, defaulting absent path and locations to empty arrays.

    GraphQLError::not_equal

    fn GraphQLError::not_equal(x : GraphQLError, y : GraphQLError) -> Bool

    GraphQLError::to_json

    fn GraphQLError::to_json(self : GraphQLError) -> Json

    Convert a GraphQL error into the standard JSON response shape.

    GraphQLRequest

    pub(all) struct GraphQLRequest {
    query : String
    operation_name : String?
    variables : Map[String, InputValue]
    } derive(Eq,
    Debug
    )

    Executable GraphQL request.

    query contains the operation document, operation_name selects one operation from multi-operation documents, and variables holds JSON-style GraphQL input values keyed by variable name without the leading $.

    GraphQLRequest::equal

    GraphQLRequest::new

    fn GraphQLRequest::new(query : String, operation_name? : String, variables? : Map[String, InputValue]) -> GraphQLRequest

    Build a request with empty variables by default.

    GraphQLRequest::not_equal

    fn GraphQLRequest::not_equal(x : GraphQLRequest, y : GraphQLRequest) -> Bool

    GraphQLResponse

    pub(all) struct GraphQLResponse {
    data : GqlValue?
    errors : Array[GraphQLError]
    } derive(Eq,
    Debug
    )

    GraphQL execution response.

    Successful field data is stored in data; parse, validation, coercion, and resolver failures are accumulated in errors.

    GraphQLResponse::data

    Create a response containing only data.

    GraphQLResponse::equal

    GraphQLResponse::error

    fn GraphQLResponse::error(message : String) -> GraphQLResponse

    Create a response containing a single top-level error message.

    GraphQLResponse::not_equal

    fn GraphQLResponse::not_equal(x : GraphQLResponse, y : GraphQLResponse) -> Bool

    GraphQLResponse::to_json

    fn GraphQLResponse::to_json(self : GraphQLResponse) -> Json

    Convert the response into the standard GraphQL JSON envelope.

    InputValue

    pub(all) enum InputValue {
    InputNull
    InputString(String)
    InputBoolean(Bool)
    InputInt(Int64)
    InputFloat(Double)
    InputEnum(String)
    InputList(Array[InputValue])
    InputObject(Map[String, InputValue])
    } derive(Eq,
    Debug
    )

    GraphQL input value used for variables, literals after coercion, and resolver arguments.

    InputEnum preserves the distinction between enum tokens and strings while allowing later coercion against enum definitions.

    InputValue::equal

    fn InputValue::equal(InputValue, InputValue) -> Bool

    InputValue::from_json

    fn InputValue::from_json(json : Json) -> InputValue

    Convert JSON request data into GraphQL input values.

    JSON numbers with no fractional component become InputInt; other numbers become InputFloat. Enum values cannot be represented distinctly in JSON and are therefore parsed as InputString.

    InputValue::not_equal

    fn InputValue::not_equal(x : InputValue, y : InputValue) -> Bool

    InputValue::to_json

    fn InputValue::to_json(self : InputValue) -> Json

    Convert an input value into JSON for transport or diagnostics.

    IntrospectionFormat

    pub(all) enum IntrospectionFormat {
    Full
    TypeNamesOnly
    } derive(Eq,
    Debug
    )

    Shape of the JSON introspection payload returned by introspect.

    IntrospectionFormat::equal

    IntrospectionFormat::not_equal

    PathSegment

    pub(all) enum PathSegment {
    PathField(String)
    PathIndex(Int)
    } derive(Eq,
    Debug
    )

    Segment in a GraphQL response error path.

    PathSegment::equal

    fn PathSegment::equal(PathSegment, PathSegment) -> Bool

    PathSegment::not_equal

    fn PathSegment::not_equal(x : PathSegment, y : PathSegment) -> Bool

    PathSegment::to_json

    fn PathSegment::to_json(self : PathSegment) -> Json

    Convert a path segment into the JSON representation used in GraphQL errors.

    ResolveInfo

    pub(all) struct ResolveInfo {
    type_name : String
    field_name : String
    response_key : String
    path : Array[PathSegment]
    source : GqlValue
    } derive(Eq,
    Debug
    )

    Field resolver metadata supplied by the executor.

    response_key includes aliases, path points to the response position, and source carries the parent value being completed.

    ResolveInfo::equal

    fn ResolveInfo::equal(ResolveInfo, ResolveInfo) -> Bool

    ResolveInfo::not_equal

    fn ResolveInfo::not_equal(x : ResolveInfo, y : ResolveInfo) -> Bool

    SchemaBuilder

    pub(all) struct SchemaBuilder[Ctx] {
    registry : TypeRegistry
    query_type : String
    mutation_type : String?
    subscription_type : String?
    resolvers : Map[String, async (ResolveInfo, Args, Ctx) -> GqlValue]
    subscriptions : Map[String, async (ResolveInfo, Args, Ctx) -> SubscriptionStream]
    type_resolvers : Map[String, async (String, GqlValue, Ctx) -> String]
    validation : ValidationConfig
    }

    Mutable builder used to compile SDL and register resolvers.

    The builder is generic over user context type Ctx, allowing applications to pass request-scoped state directly to resolvers.

    SchemaBuilder::disable_introspection

    fn[Ctx] SchemaBuilder::disable_introspection(self : SchemaBuilder[Ctx], disabled : Bool) -> SchemaBuilder[Ctx]

    Enable or disable access to __schema, __type, and other introspection fields during request validation.

    SchemaBuilder::finish

    fn[Ctx] SchemaBuilder::finish(self : SchemaBuilder[Ctx]) -> ExecutableSchema[Ctx] raise SchemaError

    Validate resolver coverage and freeze the builder into an executable schema.

    Query and mutation root fields must have regular resolvers. Subscription root fields may have either regular execution resolvers or subscription stream resolvers.

    SchemaBuilder::from_sdl

    fn[Ctx] SchemaBuilder::from_sdl(source : String) -> SchemaBuilder[Ctx] raise SchemaError

    Parse and compile GraphQL SDL into a resolver builder.

    Built-in scalars and directives are installed automatically. Raises SchemaError when SDL parsing, duplicate definitions, or schema references fail validation.

    SchemaBuilder::resolve

    fn[Ctx] SchemaBuilder::resolve(self : SchemaBuilder[Ctx], type_name : String, field_name : String, resolver : async (ResolveInfo, Args, Ctx) -> GqlValue) -> SchemaBuilder[Ctx]

    Register an async resolver for an object or interface field.

    The resolver key is the pair (type_name, field_name). Register root field resolvers before calling finish.

    SchemaBuilder::resolve_type

    fn[Ctx] SchemaBuilder::resolve_type(self : SchemaBuilder[Ctx], type_name : String, resolver : async (String, GqlValue, Ctx) -> String) -> SchemaBuilder[Ctx]

    Register an async resolver for an interface or union runtime type.

    finish validates that type_name names an abstract output type.

    SchemaBuilder::subscribe

    fn[Ctx] SchemaBuilder::subscribe(self : SchemaBuilder[Ctx], type_name : String, field_name : String, resolver : async (ResolveInfo, Args, Ctx) -> SubscriptionStream) -> SchemaBuilder[Ctx]

    Register an async resolver for a subscription root field.

    SourceLocation

    pub(all) struct SourceLocation {
    line : Int
    column : Int
    } derive(Eq,
    Debug
    )

    1-based source location used in GraphQL errors.

    SourceLocation::equal

    SourceLocation::not_equal

    fn SourceLocation::not_equal(x : SourceLocation, y : SourceLocation) -> Bool

    SourceLocation::to_json

    fn SourceLocation::to_json(self : SourceLocation) -> Json

    Convert a source location into the JSON representation used in errors.

    SubscriptionStream

    pub(all) struct SubscriptionStream {
    queue :
    Queue
    [GraphQLResponse]
    }

    Queue-backed stream of GraphQL subscription events.

    Producers publish GraphQLResponse values and close the stream when no more events will be sent.

    SubscriptionStream::close

    fn SubscriptionStream::close(self : SubscriptionStream) -> Unit

    Close the stream so future next calls finish with None.

    SubscriptionStream::new

    Create an unbounded subscription stream.

    SubscriptionStream::next

    Wait for the next response event.

    Returns None when the stream is closed or when the current async task is being cancelled.

    SubscriptionStream::publish

    async fn SubscriptionStream::publish(self : SubscriptionStream, response : GraphQLResponse) -> Unit

    Publish a response event to waiting subscription consumers.

    TypeDef

    pub(all) enum TypeDef {
    ScalarDef(String?)
    ObjectDef(description~ : String?, fields~ : Map[String, FieldDef], interfaces~ : Array[String])
    InterfaceDef(description~ : String?, fields~ : Map[String, FieldDef], interfaces~ : Array[String])
    UnionDef(description~ : String?, members~ : Array[String])
    EnumDef(description~ : String?, values~ : Array[String])
    InputObjectDef(description~ : String?, fields~ : Map[String,
    InputValue
    ])
    } derive(Eq,
    Debug
    )

    Runtime type definition compiled from GraphQL SDL.

    Input and output definitions are stored together because validation and introspection need to traverse the complete schema registry.

    TypeDef::equal

    fn TypeDef::equal(TypeDef, TypeDef) -> Bool

    TypeDef::fields

    fn TypeDef::fields(self : TypeDef) -> Map[String, FieldDef]?

    Return field definitions for object and interface types.

    TypeDef::is_input

    fn TypeDef::is_input(self : TypeDef) -> Bool

    Return true when the type can appear in GraphQL input positions.

    TypeDef::is_leaf

    fn TypeDef::is_leaf(self : TypeDef) -> Bool

    Return true for scalar and enum output types.

    TypeDef::not_equal

    fn TypeDef::not_equal(x : TypeDef, y : TypeDef) -> Bool

    TypeDef::to_repr

    TypeRegistry

    pub(all) struct TypeRegistry {
    types : Map[String, TypeDef]
    directives : Map[String, DirectiveSpec]
    } derive(Eq,
    Debug
    )

    Compiled GraphQL schema registry.

    The registry stores user SDL definitions plus built-in scalars and directives. Public lookup helpers keep validators, executors, and tools from depending on map internals.

    TypeRegistry::contains

    fn TypeRegistry::contains(self : TypeRegistry, name : String) -> Bool

    Return true when a type name exists in the registry.

    TypeRegistry::equal

    TypeRegistry::field

    fn TypeRegistry::field(self : TypeRegistry, type_name : String, field_name : String) -> FieldDef?

    Look up a field on an object or interface type.

    TypeRegistry::get

    fn TypeRegistry::get(self : TypeRegistry, name : String) -> TypeDef?

    Look up a compiled type by name.

    TypeRegistry::not_equal

    fn TypeRegistry::not_equal(x : TypeRegistry, y : TypeRegistry) -> Bool

    ValidationConfig

    pub(all) struct ValidationConfig {
    disable_introspection : Bool
    } derive(Eq,
    Debug
    )

    Validation toggles captured in an executable schema.

    ValidationConfig::default

    Default validation configuration.

    ValidationConfig::equal

    ValidationConfig::not_equal

    fn ValidationConfig::not_equal(x : ValidationConfig, y : ValidationConfig) -> Bool

    execute

    async fn[Ctx] execute(schema : ExecutableSchema[Ctx], request : GraphQLRequest, context : Ctx) -> GraphQLResponse

    Execute a GraphQL request and return only the GraphQL response envelope.

    Use execute_with_status when an HTTP transport needs to distinguish parse, validation, and variable coercion failures from successful execution.

    execute_with_status

    async fn[Ctx] execute_with_status(schema : ExecutableSchema[Ctx], request : GraphQLRequest, context : Ctx) -> ExecutionHttpResult

    Execute a GraphQL request with parser, validator, variable coercion, resolver execution, and GraphQL value completion.

    Parse, validation, variable coercion, and root operation errors return status 400. Resolver and completion errors are represented inside the GraphQL response with status 200, following common GraphQL HTTP behavior.

    introspect

    fn[Ctx] introspect(schema : ExecutableSchema[Ctx], format? : IntrospectionFormat) -> Json

    Build a JSON introspection view of an executable schema.

    Full returns root operation types, type metadata, field/input/enum details, union members, and directives. TypeNamesOnly is a compact view for diagnostics and simple tooling.

    start_subscription

    async fn[Ctx] start_subscription(schema : ExecutableSchema[Ctx], request : GraphQLRequest, context : Ctx) -> Result[SubscriptionStream, GraphQLResponse]

    Start a subscription operation and return its response stream.

    This validates the request as a subscription, coerces variables and arguments, and invokes the registered subscription resolver for the single selected root field.

    validate

    fn[Ctx] validate(schema : ExecutableSchema[Ctx], request : GraphQLRequest) -> Array[GraphQLError]

    Validate a request and return GraphQL errors without executing resolvers.

    This is useful for editor integrations, preflight checks, and tests. Parse or validation failures are returned as GraphQLError values; an empty array means the request is executable for the supplied schema.