Functions for parsing and coercing string parameters.
The OpenAPI specification uses JSON Schema to describe datastructures that will be communicated.
When data is communicated in the request/response body, the assumption is that a reasonably rich format like JSON or YAML will be used to serialize the data "losslessly", with corresponding content-type and content-encoding headers. In this case, the relevant schemas in the OpenAPI document can be used to verify the parsed message body "as is".
When data is communicated through "parameters" (query parameters, header values, cookies or path segments), there is no standard method for communicating a data format in the request/response; the parameters are treated as sets of plain string key-value pairs.
An OpenAPI documenent can provide Parameter objects to describe
formats and complex schemas for these key-value pairs.
A Parameter object describes a single named parameter. For our purposes the following properties are useful:
See also https://swagger.io/specification/#parameter-object
Note that style, explode and the schema type are used to
describe how to map strings to collections. For leaf nodes in
collections or scalar paramers, the schema type is used to
coerce strings to the correct type (integer, number, boolean).
This namespace is concerned with parsing and coercion of
parameters. The validation of the decoded parameters is handled by
the various *.validator namespaces.
Functions for parsing and coercing string parameters.
The OpenAPI specification uses JSON Schema to describe
datastructures that will be communicated.
When data is communicated in the request/response body, the
assumption is that a reasonably rich format like JSON or YAML will
be used to serialize the data "losslessly", with corresponding
content-type and content-encoding headers. In this case, the
relevant schemas in the OpenAPI document can be used to verify the
parsed message body "as is".
When data is communicated through "parameters" (query parameters,
header values, cookies or path segments), there is no standard
method for communicating a data format in the request/response; the
parameters are treated as sets of plain string key-value pairs.
An OpenAPI documenent can provide `Parameter` objects to describe
formats and complex schemas for these key-value pairs.
A Parameter object describes a single named parameter. For our
purposes the following properties are useful:
- name: The name of the parameter
- in: Location in the message (header, query, path, cookie)
- required: boolean
- allowEmptyValue: empty string means no value
- style: serialization style
- explode: how to represent collections (depends on style)
- allowReserved: (not currently implemented)
- schema: the schema of the /deserialized/ parameter
- content: a map of content-type to media-type, for parameters
encoded using rich formats.
See also https://swagger.io/specification/#parameter-object
Note that `style`, `explode` and the `schema` `type` are used to
describe how to map strings to collections. For leaf nodes in
collections or scalar paramers, the `schema` `type` is used to
coerce strings to the correct type (integer, number, boolean).
This namespace is concerned with parsing and coercion of
parameters. The validation of the decoded parameters is handled by
the various `*.validator` namespaces.(request-parameters-parser {:keys [specification] :as context}
canonical-schema-path)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |