OpenAPI 3.0 Standards Compliance
Supported Components
The following components are not supported:
examples
securitySchemes
links
callbacks
Supported Data Types
null
is not a type in OpenAPI, but it is a type in JSON Schema. Since OaDocument (theoretically) should support both, null
is allowed as a data type.
Confer: * https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#data-types * https://json-schema.org/understanding-json-schema/reference/null
Supported Content Types
Only JSON is supported. XML is not supported.
Schema Fields
- The
readOnly
andwriteOnly
field are ignored. - The
discriminator
field is ignored. - The
externalDocs
field is ignored.
Built-in Formats
The format
property can influence all data types except the following: * unit
. If you need different flavors of a zero-dimension value, use null
. There are data formats like Ion where the flavor of null
is important.
As of this version of OaDocument only the following formats are supported:
"date-time"
which is represented as aPtime.t
"time"
which is represented as aPtime.time
"duration"
which is represented as aPtime.date
Other formats are supported in "vendor" extensions.
Supported Vendor Extensions
StripeExt
supports the"unix-time"
epoch second time format
Abstract representation of OpenAPI documents
type operation_id = OaTypes.operation_id =
| OpPath of {
doc_path : Json_query.path;
path_template : string;
name : string;
}
(*
*)OpPath {doc_path;path_template;name}
is the operation identifier when theid = field "operationId"
is not specified, causing the document pathdoc_path
to become the unique identifier.| OpId of {
}
(*
*)OpId {id;path_template;name}
is the operation identifier when theid = field "operationId"
is specified.
The type of unique identifier for an operation.
Each operation identifier has a path_template
like "/v1/accounts/{accountId}"
and an operation name
like "get"
.
type param_ref = OaTypes.param_ref = {
param_name : string;
(*The name of the parameter. Parameter names are case sensitive. If in is "path", the name field MUST correspond to the associated path segment from the path field in the Paths Object. See Path Templating for further information. If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. For all other cases, the name corresponds to the parameter name used by the in property.
*)param_in : param_in;
(*The location of the parameter. Possible values are "query", "header", "path" or "cookie".
*)
}
The fields that make a unique parameter.
Confer: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#parameter-object > A unique parameter is defined by a combination of a name and location.
Name is the parameter name
field and location is the parameter in
field.
The uniqueness is relative to an operation.
The type of a OpenAPI specification document.
Conventionally the document is named "openapi.json"
or "openapi.yaml"
.
type schema = OaTypes.schema = {
title : string option;
(*An optional short description.
*)description : string option;
(*An optional long description.
*)default : Json_repr.any option;
(*A default constant to be substituted in case of a missing value.
*)enum : Json_repr.any list option;
(*A valid value must equal one of these constants.
*)kind : schema_kind;
(*The type-specific part.
*)format : string option;
(*predefined formats such as
*)date-time
,email
,ipv4
,ipv6
,uri
.id : string option;
(*An optional ID.
In JSON Schema multiple schemas can be bundled into a single schema using the
*)$id
(orid
in Draft 4 or later) field. Confer with JSON Schema Bundling.schema_ref : Json_query.path;
(*
*)schema_ref
is the location of the schema in the document.
}
A Schema object.
All fields except kind
are type-agnostic specifications.
and schema_kind = OaTypes.schema_kind =
| Object of object_specs
(*The type of an object.
*)| Array of schema list * array_specs
(*An fixed-length array with the types of its elements (a tuple).
*)| Monomorphic_array of schema * array_specs
(*A variable-length array with the type of its children.
*)| Combine of combinator * schema list
(*A mix of schemas using logical combinators.
*)| Schema_ref of Json_query.path
(*A ref to an element from its path in the JSON representation.
*)| Id_ref of string
(*A ref to an element from its ID.
*)| Ext_ref of Restapis_o.Open__.Uri.t
(*A ref to an external element.
*)| String of string_specs
(*A string (with optional characteristics).
*)| Integer of numeric_specs
(*An int (with optional characteristics).
*)| Number of numeric_specs
(*A float (with optional characteristics).
*)| Boolean
(*Any boolean.
*)| Null
(*The null value.
*)| Any
(*Any JSON value.
*)| Dummy
(*For building cyclic definitions, a component bound to a dummy will be considered absent for
*)add_schema
but present forupdate
. The idea is to insert a dummy component, build a cyclic structure using it for recursion, and finally update the component with the structure.
The type-specific part of schema nodes.
Grammar combinators.
and array_specs = OaTypes.array_specs = {
min_items : int;
(*The minimum number of elements.
*)max_items : int option;
(*The maximum number of elements.
*)unique_items : bool;
(*Teels if all elements must be different.
*)additional_items : schema option;
(*The type of additional items, if allowed.
*)
}
Parameters of the Array
and MonomorphicArray
type specifiers.
and numeric_specs = OaTypes.numeric_specs = {
multiple_of : float option;
(*An optional divisor of valid values
*)minimum : (float * [ `Inclusive | `Exclusive ]) option;
(*The optional lower bound of the numeric range
*)maximum : (float * [ `Inclusive | `Exclusive ]) option;
(*The optional upper bound of the numeric range
*)
}
Parameters of the Integer
and Number
type specifiers.
and object_specs = OaTypes.object_specs = {
properties : object_props list;
(*The names and types of properties, with a flag to indicate if they are required (
*)true
) or optional.pattern_properties : (string * schema) list;
(*Alternative definition of properties, matching field names using regexps instead of constant strings.
*)additional_properties : schema option;
(*The type of additional properties, if allowed.
*)min_properties : int;
(*The minimum number of properties.
*)max_properties : int option;
(*The maximum number of properties.
*)schema_dependencies : (string * schema) list;
(*Additional schemas the value must verify if a property is present (property, additional schema).
*)property_dependencies : (string * string list) list;
(*Additional properties required whenever some property is present (property, additional properties).
*)
}
Parameters of the Object
type specifier.
and string_specs = OaTypes.string_specs = {
pattern : string option;
(*A regexp the string must conform to.
*)min_length : int;
(*The minimum string length.
*)max_length : int option;
(*The maximum string length.
*)str_format : string option;
}
Parameters of the String
type specifier.
and object_props = OaTypes.object_props = {
prop_name : string;
prop_type : schema;
required : bool;
(*Whether the property is required or not.
*)nullable : bool;
(*Allows sending a null value for the defined schema. Default value is false.
*)read_only : bool;
(*Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
*)write_only : bool;
(*Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
*)deprecated : bool;
(*Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
*)additional : bool;
(*Whether the property is part of the known fields (
*)false
) or whether the property represents all additional fields (true
).
}
Object properties.
Path Object in the document.
and path_item = OaTypes.path_item = {
path_item_summary : string option;
path_item_description : string option;
path_item_parameters : parameter list;
path_item_kind : path_item_kind;
get : operation option;
put : operation option;
post : operation option;
delete : operation option;
options : operation option;
head : operation option;
patch : operation option;
trace : operation option;
}
Path Item Object in the document.
The parameters defined at the Path Item level are available at the deeper operation
level, with Operation overrides applied.
All fields except path_item_kind
are optional or have reasonable defaults.
and path_item_kind = OaTypes.path_item_kind =
| PathItem_ref of Json_query.path
| PathItemExt_ref of Restapis_o.Open__.Uri.t
| PathItem
| PathItemNone
(*No path item which is allowed under OpenAPI Security Filtering
*)| PathItemDummy
(*For building cyclic definitions, a path object bound to a dummy will be considered absent for
*)add_path
andfold_all_paths
but present forupdate_path
. The idea is to insert a dummy path object, build a cyclic structure using it for recursion, and finally update the path object with the structure.
and operation = OaTypes.operation = {
operation_summary : string option;
operation_description : string option;
operation_id : operation_id;
operation_parameters : parameter list;
operation_segs : operation_seg list;
operation_request_body : request_body option;
operation_responses : responses;
}
An Operation object in the document.
and operation_seg = OaTypes.operation_seg =
| OpLiteralPart of string
| OpFieldPart of {
field_name : string;
field_parameter : parameter;
}
and request_body = OaTypes.request_body = {
request_body_description : string option;
request_body_content : (string * media_type) list;
request_body_kind : request_body_kind;
}
A Request Body object.
All fields except request_body_kind
are optional or have reasonable defaults.
and request_body_kind = OaTypes.request_body_kind =
| RequestBody of request_body_specs
| RequestBody_ref of Json_query.path
(*A ref to a parameters object from its path in the JSON representation.
*)| RequestBodyExt_ref of Restapis_o.Open__.Uri.t
| RequestBodyDummy
(*For building cyclic definitions, a request body bound to a dummy will be considered absent for
*)add_request_body
andfold_request_body
but present forupdate_request_body
. The idea is to insert a dummy parameter, build a cyclic structure using it for recursion, and finally update the request body with the structure.
and parameter = OaTypes.parameter = {
parameter_description : string option;
(*A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
*)parameter_deprecated : bool;
(*Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
*)parameter_allow_empty_value : bool;
(*Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
*)parameter_allow_reserved : bool;
(*Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
*)parameter_schema : schema option;
parameter_content : (string * media_type) option;
(*A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
*)parameter_kind : parameter_kind;
}
A Parameter object.
All fields except parameter_kind
are optional or have reasonable defaults.
and parameter_kind = OaTypes.parameter_kind =
| Parameter of parameter_specs
(*The type of a Parameter.
*)| Parameter_ref of Json_query.path
(*A ref to a parameters object from its path in the JSON representation.
*)| ParameterExt_ref of Restapis_o.Open__.Uri.t
| ParameterDummy
(*For building cyclic definitions, a parameter bound to a dummy will be considered absent for
*)add_parameter
andfold_operation_parameters
but present forupdate_parameter
. The idea is to insert a dummy parameter, build a cyclic structure using it for recursion, and finally update the parameter with the structure.
and parameter_specs = OaTypes.parameter_specs = {
parameter_ref : param_ref;
parameter_required : bool;
(*Determines whether this parameter is mandatory. If the parameter location is "path", this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
*)parameter_style : param_style;
(*Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
*)parameter_explode : bool;
(*When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
*)
}
and responses = OaTypes.responses = {
default_response : response option;
coded_responses : (response_code * response) list;
}
A Responses object.
and response = OaTypes.response = {
response_headers : (string * header) list;
response_content : (string * media_type) list;
response_kind : response_kind;
}
A Response object.
All fields except response_kind
are optional or have reasonable defaults.
and response_kind = OaTypes.response_kind =
| Response of response_specs
| Response_ref of Json_query.path
(*A ref to a parameters object from its path in the JSON representation.
*)| ResponseExt_ref of Restapis_o.Open__.Uri.t
| ResponseDummy
(*For building cyclic definitions, a parameter bound to a dummy will be considered absent for
*)add_response
andfold_all_responses
but present forupdate_response
. The idea is to insert a dummy parameter, build a cyclic structure using it for recursion, and finally update the parameter with the structure.
and header = OaTypes.header = {
header_description : string option;
(*A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
*)header_deprecated : bool;
(*Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
*)header_allow_empty_value : bool;
(*Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
*)header_allow_reserved : bool;
(*Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
*)header_schema : schema option;
header_kind : header_kind;
}
A Header object.
All fields except header_kind
are optional or have reasonable defaults.
and header_kind = OaTypes.header_kind =
| Header of header_specs
| Header_ref of Json_query.path
(*A ref to a parameters object from its path in the JSON representation.
*)| HeaderExt_ref of Restapis_o.Open__.Uri.t
| HeaderDummy
(*For building cyclic definitions, a header bound to a dummy will be considered absent for
*)add_header
andfold_all_headers
but present forupdate_header
. The idea is to insert a dummy parameter, build a cyclic structure using it for recursion, and finally update the header with the structure.
and header_specs = OaTypes.header_specs = {
header_required : bool;
(*Determines whether this header is mandatory. Its default value is false.
*)header_explode : bool;
(*When this is true, header values of type array or object generate separate headers for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. The default value is false.
*)
}
The details for a header. The style is always simple
.
A Media Type object.
type primitive_kind = [
| `PrimitiveString of string_specs
(*A string (with optional characteristics).
*)| `PrimitiveInteger of numeric_specs
(*An int (with optional characteristics).
*)| `PrimitiveNumber of numeric_specs
(*A float (with optional characteristics).
*)| `PrimitiveBoolean
(*Any boolean.
*)| `PrimitiveNull
(*The null value.
*)| `PrimitiveAny
(*Any JSON value.
*)
]
Primitive kind.
to_json_schema t
converts the OpenAPI schemas t
to a JSON schema, possibly with a loss of information.
Schema Objects and combinators
Compliant OpenAPI specifications, unlike JSON Schema specs, do not have a root element. However, to support vendor extensions the root element has been exposed.
Compliant OpenAPI will have any
as the root element, and uses Component Objects
instead.
Construct a naked Schema object with all optional properties as None
.
Construct a schema from its root, without any component ; the element is checked not to contain any Def
element.
Update a schema from its root, using the definitions from an existing schema ; the element is checked to contain only valid Def
elements ; unused definitions are kept, see simplify_schema
.
Combines several schemas.
Schema Objects
Nomenclature: Schemas uses schema paths which are JSON pointers referencing locations in schema documents. There is another type of path ... the path object ... which is the path the client or browser sends to a server. The documentation will be easier to understand if you keep those paths separate in your mind.
Merges the definitions of two schemas if possible and returns the updated schemas, so that their elements can be mixed without introducing dangling references ; if two different definitions are bound to the same path, Duplicate_schema
will be raised.
add_schema name schema t
adds a Schema object by its name or document path name
.
If name
is an absolute path starting with a '/'
, it is untouched. Otherwise, it is considered relative to schemas_path
(defaults to "#/components/schemas"
as recommended by the OpenAPI standard). May raise Duplicate_schema
if this path is already used or any error raised by Json_repr.path_of_json_pointer
with ~wildcards:false
.
Returns the modified document and the modified schema.
The modified schema will have a kind = Schema_ref _
that is a re-usable reference to the schema in the document.
find_schema name
finds a Schema object by its document path.
May raise Not_found
. See add_schema
for the name format.
Tells if a document path leads to a Schema object. See add_schema
for the name format.
Build a reference to a Schema object. See add_schema
for the name format.
fold_all_schemas t f init
computes (f sN ... (f s1 init)...)
, where s1 ... sN
are the schemas (in increasing schema_ref
order).
When a Schema is a compound data type (array
or object
), only the root of the compound data type is folded. No array children are folded, and no object fields are folded. If you need a flattened traversal of compound data types, use OaSummary.datatypes
with ~query_selector:`FlattenedAll
instead.
Header Objects
Construct a naked header (all optional properties to None).
find_header name t
finds a Header object by its name or document path name
.
May raise Not_found
. See add_header
for the name format.
find_header' path t
finds a Header object by its document path path
.
May raise Not_found
.
add_header ?headers_path name header
adds a Parameter object header
by its name or document path name
.
If name
is an absolute path starting with a '/'
, it is untouched. Otherwise, it is considered relative to schemas_path
(defaults to "#/components/headers"
as recommended by the OpenAPI standard). May raise Duplicate_header
if this path is already used or any error raised by Json_repr.path_of_json_pointer
with ~wildcards:false
.
Returns the modified document and the modified header.
The modified header will have a header_kind = Header_ref _
that is a re-usable reference to the header in the document.
fold_all_headers t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of all headers (in increasing order), and d1 ... dN
are the associated headers.
Parameter Objects
Construct a naked parameter (all optional properties to None).
find_parameter name t
finds a Parameter object by its name or document path name
.
May raise Not_found
. See add_parameter
for the name format.
find_parameter' path t
finds a Parameter object by its document path path
.
May raise Not_found
.
val find_operation_parameter :
?paths_path:string ->
operation_id:operation_id ->
param_name:string ->
param_in:param_in ->
t ->
parameter
find_operation_parameter ~operation_id ~param_name ~param_in t
finds the most specific Parameter
for the parameter named param_name
of the operation operation_id
.
The most specific Parameter
is the parameter attached to the operation at paths_path / path / operation / "parameters"
if that exists. Otherwise the parameter paths_path / path / "parameters"
is the most specific.
add_parameter ?parameters_path name parameter
adds a Parameter object parameter
by its name or document path name
.
If name
is an absolute path starting with a '/'
, it is untouched. Otherwise, it is considered relative to schemas_path
(defaults to "#/components/parameters"
as recommended by the OpenAPI standard). May raise Duplicate_parameter
if this path is already used or any error raised by Json_repr.path_of_json_pointer
with ~wildcards:false
.
Returns the modified document and the modified parameter.
The modified parameter will have a parameter_kind = Parameter_ref _
that is a re-usable reference to the parameter in the document.
fold_all_request_bodies t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of all request bodies (in increasing order), and d1 ... dN
are the associated request bodies.
val fold_operation_parameters :
t ->
(operation_id -> string -> param_in -> parameter -> 'a -> 'a) ->
'a ->
'a
fold_operation_parameters t f init
computes (f oN nN lN pN ... (f o1 n1 l1 p1 init)...)
, where o1 ... oN
are the Operations, n1 ... nN
are the parameter names, l1 ... lN
are the parameter locations, and p1 ... pN
are the parameters.
Request Body Objects
Construct a naked request_body (all optional properties to None).
find_request_body name t
finds a Request Body object by its name or document path name
.
May raise Not_found
. See add_request_body
for the name format.
find_request_body' path t
finds a Request Body object by its document path path
.
May raise Not_found
.
val add_request_body :
?request_bodies_path:string ->
string ->
request_body ->
t ->
t * request_body
add_request_body ?request_bodies_path name request_body
adds a Request Body object request_body
by its name or document path name
.
If name
is an absolute path starting with a '/'
, it is untouched. Otherwise, it is considered relative to schemas_path
(defaults to "#/components/requestBodies"
as recommended by the OpenAPI standard). May raise Duplicate_request_body
if this path is already used or any error raised by Json_repr.path_of_json_pointer
with ~wildcards:false
.
Returns the modified document and the modified request body.
The modified request body will have a request_body_kind = Request_body_ref _
that is a re-usable reference to the request body in the document.
fold_all_request_bodies t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of all request bodies (in increasing order), and d1 ... dN
are the associated request bodies.
val fold_operation_request_bodies :
t ->
(operation_id -> request_body -> 'a -> 'a) ->
'a ->
'a
fold_operation_request_bodies t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of Operation objects' requestBody
field (in increasing document path order), and d1 ... dN
are the associated Request Body objects.
If there is no requestBody
supplied for an Operation object, the operation is skipped.
Response Objects
Construct a naked response (all optional properties to None).
find_response name t
finds a Parameter object by its name or document path name
.
May raise Not_found
. See add_response
for the name format.
add_response ?responses_path name response
adds a Parameter object response
by its name or document path name
.
If name
is an absolute path starting with a '/'
, it is untouched. Otherwise, it is considered relative to schemas_path
(defaults to "#/components/responses"
as recommended by the OpenAPI standard). May raise Duplicate_response
if this path is already used or any error raised by Json_repr.path_of_json_pointer
with ~wildcards:false
.
Returns the modified document and the modified response.
The modified response will have a response_kind = Response_ref _
that is a re-usable reference to the response in the document.
fold_all_responses t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of all Response objects (in increasing order), and d1 ... dN
are the associated Response objects.
fold_operation_responses t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the document paths of Operation objects' responses
field (in increasing document path order), and d1 ... dN
are the associated Responses objects.
Path and Path Item Objects
Nomenclature: Path objects are the paths the client or browser sends to a server. There is another type of path .. the document path ... which is a JSON pointer referencing a location in a schema document. The documentation will be easier to understand if you keep those paths separate in your mind.
Construct a naked Path Item (all optional properties to None).
add_path path_template item t
adds a Path object that responds or requests URLs of the concrete path or path template path_template
.
path_template
is the object key within paths_path
(defaults to "#/paths"
as recommended by the OpenAPI standard). For example, when path_template = "v1/prices/{price}"
the Path object is added as:
{ paths: { "v1/prices/{price}": ... } }
The item
may have path_item_kind = PathItemNone
for Security Filtering.
Returns the modified schema and the modified path item.
The modified path item will have a path_item_kind = PathItem_ref _
that is a re-usable reference to the path item in the document.
fold_all_paths t f init
computes (f kN dN ... (f k1 d1 init)...)
, where k1 ... kN
are the path segments of all Path objects (in ascending order of the number of field segments in the path), and d1 ... dN
are the associated Path Item objects (which may have a path_item_kind
= PathItemNone
).
Paths with PathItemDummy
items are skipped.
The ordering k1
is before kN
conforms to the "before" matching ordering:
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#paths-object > When matching URLs, concrete (non-templated) paths would be matched > before their templated counterparts.
Predefined values
Default Parameters of the Array
and MonomorphicArray
type specifiers.
Default parameters of the Object
type specifier.
Default parameters of the String
type specifier.
Default parameters of the Integer
and Number
type specifiers.
Standard Extensions
The standard extensions provide a baseline of definitions that the vendor extensions can extend.
Vendor Extensions
JSON Serialization
Formats OpenAPI schemas as its JSON representation.
This function works with JSON data represented in the Json_repr.ezjsonm
format. See functor Make
for using another representation.
val of_json :
?schemas_path:string ->
?parameters_path:string ->
?paths_path:string ->
?headers_path:string ->
?responses_path:string ->
?request_bodies_path:string ->
Json_repr.ezjsonm ->
t
Parse a JSON structure as OpenAPI schemas, if possible. May throw Cannot_parse
.
This function works with JSON data represented in the Json_repr.ezjsonm
format. See functor Make
for using another representation.
Formats OpenAPI schemas in human readable format.
Errors
A reference to a non-existent location was detected.
A non-Dummy
schema appeared twice on insertion or merge.
A non-Dummy
header appeared twice on insertion or merge.
A non-Dummy
request body appeared twice on insertion or merge.
A non-Dummy
response appeared twice on insertion or merge.
The same parameter name and location (the in
field) appeared twice on insertion or merge.
val print_error :
?print_unknown:(Restapis_o.Open__.Format.formatter -> exn -> unit) ->
Restapis_o.Open__.Format.formatter ->
exn ->
unit
Produces a human readable version of an error.
Advanced interface for using a custom JSON representation
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.