OCaml let getRestOperation = Routes.ksprintf k x
printer.
type response_info = {
requestbody : requestbody_json_match option;
(*The best request body, if any. Useful for clients to pick the best one.
*)statuscodes : statuscode_info list;
default_statuscode_qualified_type : string option;
requestbody_serdes : ([ `Tag of string ] * string) list;
(*All of the request body serdes. Useful for servers which must implement all request body types.
*)requestbody_unsupported_content : ([ `Tag of string ] * [ `MediaType of string ]) list;
}
and requestbody_json_match = {
requestbody_required : bool;
requestbody_qualified_type : string;
requestbody_content_type : string;
requestbody_content_type_tag : string;
requestbody_serde : string;
requestbody_encoder_pp : Restapis_o.Open__.Format.formatter -> unit -> unit;
}
and statuscode_info = {
statuscode_tag : string;
statuscode_code_expr : [ `Literal of int | `Variable of string ];
statuscode_pattern : string;
statuscode_is_default : bool;
statuscode_json_match : statuscode_json_match option;
out_headers : header_info list;
}
and statuscode_json_match = {
statuscode_qualified_type : string;
statuscode_serde : string;
statuscode_encoder_pp : Restapis_o.Open__.Format.formatter -> unit -> unit;
}
and header_info = {
header_tag : string;
header_qualified_type : string;
header_json_match : header_json_match option;
}
and header_json_match = {
header_literal : string;
header_encoder_pp : Restapis_o.Open__.Format.formatter -> unit -> unit;
header_required : bool;
header_explode : bool;
header_serde : string;
}
val gather_responses :
pp_rhs_any_datatype:
(summary:OaSummary.t ->
wrap_primitive_and_ref:OaPp.field_kind ->
format:string option ->
enum:Json_repr.any list option ->
path:Json_query.path ->
'a ->
Restapis_o.Open__.Format.formatter ->
OaTypes.schema_kind ->
unit) ->
wrap_primitive_and_ref_with_optional:bool ->
summary:OaSummary.t ->
path_template:string ->
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
'a ->
OaTypes.request_body option ->
OaTypes.responses ->
response_info
include DkCoder_Std.SCRIPT
__init context
is the entry point for running a script module. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __init
does nothing, while the bottom __init
calls the prior __init
.
That means:
- calling the
__init
function guarantees that the script module is initialized; that is, all of the script module's side-effects (ex.let () = Format.printf "Hello world@."
) are executed before the__init
returns to the caller. - you can override the
__init
function by simply defining the__init
idempotently. That will shadow the top__init
and when the bottom__init
is executed your__init
will be called instead of the do-nothing top__init
.
Future versions of DkCoder will call __init
in dependency order for all `You
script modules. Your __init
function may be called several times.
__repl context
is the entry point for debugging a script module in a REPL. The DkCoder compiler will inject this function at the top and bottom of the script module. The top __repl
does nothing, while the bottom __repl
calls the prior __repl
.
That means:
- you can override the
__repl
function by simply defining the__repl
idempotently. That will shadow the top__repl
and when the bottom__repl
is executed your__repl
will be called instead of the do-nothing top__repl
.
The run-time module information for the script module.