Primitives
single_item_array kind
gets the single element of the schema kind kind
if and only if the kind is an array and it has only one item.
val pp_type_string :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Json_schema.string_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_integer :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Json_schema.numeric_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_number :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Json_schema.numeric_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_boolean :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_null :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_any :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_type_unit :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_string :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Json_schema.string_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_integer :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Json_schema.numeric_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_number :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Json_schema.numeric_specs ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_boolean :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_null :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_any :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val pp_encoder_unit :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
Restapis_o.Open__.Format.formatter ->
unit ->
unit
val primitive_pp_type :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
OaTypes.schema_kind ->
(Restapis_o.Open__.Format.formatter -> unit -> unit) option
primitive_pp_type standard vendor ~format kind
gets the primitive type pretty-printer if and only if the schema kind kind
is a primitive type.
val primitive_pp_encoder :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
format:string option ->
enum:Json_repr.any list option ->
OaTypes.schema_kind ->
(Restapis_o.Open__.Format.formatter -> unit -> unit) option
primitive_pp_encoder standard vendor ~format kind
gets the primitive encoder pretty-printer if and only if the schema kind kind
is a primitive type.
val is_optional :
(module OaDocument.STANDARD) ->
(module OaDocument.VENDOR) ->
required:bool ->
nullable:bool ->
format:string option ->
enum:Json_repr.any list option ->
[ `PrimitiveAny
| `PrimitiveBoolean
| `PrimitiveInteger of Json_schema.numeric_specs
| `PrimitiveNull
| `PrimitiveNumber of Json_schema.numeric_specs
| `PrimitiveString of Json_schema.string_specs ]
option ->
bool
is_optional standard vendor ~required ~nullable ~format ~enum primkind
is true
when a field that may be required
and/or nullable
, having format format
and a possible enumeration of values enum
, being of possible primitive type primkind
, is optional.
Primitive Types
The standard
and vendor
modules are queried through their OaDocument.STANDARD.primitive_never_optional
and OaDocument.VENDOR.primitive_never_optional
configuration. If either is true
then is_optional
is always false
.
Variants
caseize s
make a capitalized case name of the string s
.
s
may be a type name or an enumeration value.
Duplicates need to be handled by the vendor extension. For example, Stripe's timezone
value "Etc/GMT+0"
is indistinguishable (after replacing non-alphanumeric characters with underscores) from "Etc/GMT-0"
.
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.