Make.Argtype ('obj_arg, 'a) arg_typ = {arg_typ : 'obj_arg Schema.Arg.arg_typ; |
to_json : 'a -> Yojson.Basic.t; |
}wrapper around the Arg.arg_typ type
type ('obj_arg, 'a) arg = | Arg : {
} -> ( 'obj_arg, 'a ) arg | ||||
| DefaultArg : {
} -> ( 'obj_arg, 'a ) arg |
wrapper around the Arg.arg type
Wrapper around the Arg.arg_list type.
The ocaml-graphql-server library uses this gadt type for lists of arguments used with fields and obj argument types.
This enables to the correct types for the coerce and resolve functions, in the 'args parameter below.
We wrap around this and do the same thing to build the types of the to_json functions.
val field_to_json :
'ctx 'out 'arg 'field_to_json 'obj_to_json. string ->
( 'ctx, 'out, 'arg, 'field_to_json, 'obj_to_json ) args ->
(string * Yojson.Basic.t) list ->
'field_to_jsonfield_to_json builds the serializer function for a field, based on the list of its arguments.
val arg_obj_to_json :
'ctx 'out 'arg 'field_to_json 'obj_to_json. ( 'ctx,
'out,
'arg,
'field_to_json,
'obj_to_json )
args ->
(string * Yojson.Basic.t) list ->
'obj_to_jsonarg_obj_to_json builds the serializer function for an obj argument, based on the list of its fields.
val to_ocaml_graphql_server_args :
'ctx 'out 'args_server 'field_to_json 'obj_to_json. ( 'ctx,
'out,
'args_server,
'field_to_json,
'obj_to_json )
args ->
( 'out, 'args_server ) Schema.Arg.arg_listextracts the wrapped Arg.arg_list to pass to ocaml-graphql-server functions
val int : ( int option, int option ) arg_typval scalar :
?doc:string ->
string ->
coerce:( Graphql_parser.const_value -> ( 'a, string ) Stdlib.result ) ->
to_json:( 'b -> Yojson.Basic.t ) ->
( 'a option, 'b option ) arg_typval string : ( string option, string option ) arg_typval float : ( float option, float option ) arg_typval bool : ( bool option, bool option ) arg_typval guid : ( string option, string option ) arg_typval enum :
?doc:string ->
string ->
values:'a enum_value list ->
( 'b option, 'c option ) arg_typwrapper around the enum arg_typ. For this type, the to_json function can be infered from the list of enum_value.