package graphql

  1. Overview
  2. Docs

GraphQL schema

include Graphql_intf.Schema with type 'a Io.t = 'a and type 'a Io.Stream.t = 'a Seq.t and type field_error = string
module Io : Graphql_intf.IO with type 'a t = 'a with type 'a Stream.t = 'a Seq.t
module StringMap : sig ... end
type field_error = string

Base types

type 'ctx schema
type ('ctx, 'src) field
type 'ctx subscription_field
type ('ctx, 'src) typ
type 'a enum_value

Constructors

val schema : ?mutation_name:string -> ?mutations:('ctx, unit) field list -> ?subscription_name:string -> ?subscriptions:'ctx subscription_field list -> ?query_name:string -> ('ctx, unit) field list -> 'ctx schema
type deprecated =
  1. | NotDeprecated
  2. | Deprecated of string option
val enum_value : ?doc:string -> ?deprecated:deprecated -> string -> value:'a -> 'a enum_value
val obj : ?doc:string -> string -> fields:('ctx, 'src) field list -> ('ctx, 'src option) typ
module Arg : sig ... end
type 'ctx resolve_info = {
  1. ctx : 'ctx;
  2. field : Graphql_parser.field;
  3. fragments : fragment_map;
  4. variables : variable_map;
}
val field : ?doc:string -> ?deprecated:deprecated -> string -> typ:('ctx, 'a) typ -> args:('a, 'b) Arg.arg_list -> resolve:('ctx resolve_info -> 'src -> 'b) -> ('ctx, 'src) field
val io_field : ?doc:string -> ?deprecated:deprecated -> string -> typ:('ctx, 'a) typ -> args:(('a, field_error) result Io.t, 'b) Arg.arg_list -> resolve:('ctx resolve_info -> 'src -> 'b) -> ('ctx, 'src) field
val subscription_field : ?doc:string -> ?deprecated:deprecated -> string -> typ:('ctx, 'out) typ -> args:(('out Io.Stream.t, field_error) result Io.t, 'args) Arg.arg_list -> resolve:('ctx resolve_info -> 'args) -> 'ctx subscription_field
val enum : ?doc:string -> string -> values:'a enum_value list -> ('ctx, 'a option) typ
val scalar : ?doc:string -> string -> coerce:('a -> Yojson.Basic.t) -> ('ctx, 'a option) typ
val list : ('ctx, 'src) typ -> ('ctx, 'src list option) typ
val non_null : ('ctx, 'src option) typ -> ('ctx, 'src) typ
type ('ctx, 'a) abstract_value
type ('ctx, 'a) abstract_typ = ('ctx, ('ctx, 'a) abstract_value option) typ
val union : ?doc:string -> string -> ('ctx, 'a) abstract_typ
type abstract_field
val abstract_field : ?doc:string -> ?deprecated:deprecated -> string -> typ:(_, 'a) typ -> args:('a, _) Arg.arg_list -> abstract_field
val interface : ?doc:string -> string -> fields:(('ctx, 'a) abstract_typ -> abstract_field list) -> ('ctx, 'a) abstract_typ
val add_type : ('ctx, 'a) abstract_typ -> ('ctx, 'src option) typ -> 'src -> ('ctx, 'a) abstract_value
type 'a fixpoint = {
  1. obj : 'ctx 'src 'typ 'b. ?doc:string -> string -> fields:('a -> ('ctx, 'src) field list) -> ('ctx, 'src option) typ;
  2. interface : 'ctx 'src. ?doc:string -> string -> fields:('a -> abstract_field list) -> ('ctx, 'src) abstract_typ;
}
val fix : ('a fixpoint -> 'a) -> 'a

Built-in scalars

val int : ('ctx, int option) typ
val string : ('ctx, string option) typ
val guid : ('ctx, string option) typ
val bool : ('ctx, bool option) typ
val float : ('ctx, float option) typ
type variables = (string * Graphql_parser.const_value) list
type 'a response = ('a, Yojson.Basic.t) result
val execute : 'ctx schema -> 'ctx -> ?variables:variables -> ?operation_name:string -> Graphql_parser.document -> [ `Response of Yojson.Basic.t | `Stream of Yojson.Basic.t response Io.Stream.t ] response Io.t

execute schema ctx variables doc evaluates the doc against schema with the given context ctx and variables.

OCaml

Innovation. Community. Security.