OCaml let namevalue_of_req x = y and let namevalue_to_req y = x printer of Request Body object serialization functions.

Each OpenAPI Request Body Object can have many content types like "application/x-www-form-urlencoded" that have specialized rules for how to serialize it.

Confer Describing Request Body and OpenAPI Request Body Object.

This version does not support Encoding objects. Instead, the assumption is that all object fields are encoded as deepObject and explode = true, and all other fields are encoded as form.

ctype argument

The content type of the request body like "application/x-www-form-urlencoded".

OpenAPI allows multiple content types for a request body, so a client can generate code that picks only one (probably the "application/json" if present) while a server must accept all of them and route based on the "Content-Type" request header.

One of:

  • `FormUrlEncoded is "application/x-www-form-urlencoded". Each name and value will be URL encoded per RFC 1866 (also Percent encoding). That means newline normalizaiton, replacing spaces with "+"s, and doing URL encoding for the query component of the URL, and separating name-values with "&" and names from values with "=". So "+&=" are reserved by definition, and all the query component reserved characters are also reserved. For Uri the percent encoding matches the `Query_key component. This version does not support Encoding objects. Instead, the assumption is that all object fields are encoded as deepObject and explode = true, and all other fields are encoded as form (with explode = true for array fields). Confer: Support for x-www-form-urlencoded Request Bodies
  • `Json is "application/json"

style argument

A subset of the OpenAPI style property relevant to request bodies.

Confer OpenAPI Specification Style Examples.

One of:

  • `Form
  • `DeepObject
  • `Simple - unused since don't support Encoding objects in application/x-www-form-urlencoded yet
  • `Label - unused since don't support Encoding objects in application/x-www-form-urlencoded yet
  • `SpaceDelimited - unused since don't support Encoding objects in application/x-www-form-urlencoded yet
  • `PipeDelimited - unused since don't support Encoding objects in application/x-www-form-urlencoded yet

explode argument

The OpenAPI explode property.

Confer OpenAPI Specification Style Examples.

Sourceval serializername : (module OaDocument.STANDARD) -> [< `PrimitiveType of string | `TypeAlias of string ] -> string
include DkCoder_Std.SCRIPT
Sourceval __init : DkCoder_Std.Context.t -> unit

__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:

  1. 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.
  2. 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.

Sourceval __repl : DkCoder_Std.Context.t -> unit

__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:

  1. 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.
Sourceval __module_info : unit -> DkCoder_Std.ModuleInfo.t

The run-time module information for the script module.