(coerce! match)
Returns a map of coerced input parameters using pre-compiled coercers in Match
under path [:result :coerce]
(provided by compile-request-coercers
.
Throws ex-info
if parameters can't be coerced. If coercion or parameters
are not defined, returns nil
Returns a map of coerced input parameters using pre-compiled coercers in `Match` under path `[:result :coerce]` (provided by [[compile-request-coercers]]. Throws `ex-info` if parameters can't be coerced. If coercion or parameters are not defined, returns `nil`
(coerce-query-params match query-params)
Uses an input schema and coercion implementation from the given match to encode query-parameters map.
If no match, no input schema or coercion implementation, just returns the original parameters map.
Uses an input schema and coercion implementation from the given match to encode query-parameters map. If no match, no input schema or coercion implementation, just returns the original parameters map.
Pluggable coercion protocol
Pluggable coercion protocol
(-get-name this)
Keyword name for the coercion
Keyword name for the coercion
(-get-options this)
Coercion options
Coercion options
(-request-coercer this type model)
Returns a value format => value
request coercion function
Returns a `value format => value` request coercion function
(-response-coercer this model)
Returns a value format => value
response coercion function
Returns a `value format => value` response coercion function
(-compile-model this model name)
Compiles a model
Compiles a model
(-get-model-apidocs this specification model options)
Convert model into a format that can be used in api docs
Convert model into a format that can be used in api docs
(-encode-error this error)
Converts error in to a serializable format
Converts error in to a serializable format
(-open-model this model)
Returns a new model which allows extra keys in maps
Returns a new model which allows extra keys in maps
(-query-string-coercer this model)
Returns a value => value
query string coercion function
Returns a `value => value` query string coercion function
(-get-apidocs this specification data)
Returns api documentation
Returns api documentation
(compile-request-coercers [_ {:keys [parameters coercion] :as data}] opts)
A router :compile implementation which reads the :parameters
and :coercion
data to both compile the schemas and create compiled coercers
into Match under `:result with the following keys:
key | description |
---|---|
:data | data with compiled schemas |
:coerce | function of Match -> coerced parameters to coerce parameters |
A pre-requisite to use coerce!
.
NOTE: this is not needed with ring/http, where the coercion compilation is managed in the request coercion middleware/interceptors.
A router :compile implementation which reads the `:parameters` and `:coercion` data to both compile the schemas and create compiled coercers into Match under `:result with the following keys: | key | description | ----------|------------- | `:data` | data with compiled schemas | `:coerce` | function of `Match -> coerced parameters` to coerce parameters A pre-requisite to use [[coerce!]]. NOTE: this is not needed with ring/http, where the coercion compilation is managed in the request coercion middleware/interceptors.
(content-request-coercer
coercion
{:keys [content body]}
{:reitit.coercion/keys [extract-request-format serialize-failed-result]
:or {extract-request-format extract-request-format-default}})
(match->path match)
(match->path match query-params)
Create routing path from given match and optional query-parameters map.
Query-parameters are encoded using the input schema and coercion implementation.
Create routing path from given match and optional query-parameters map. Query-parameters are encoded using the input schema and coercion implementation.
(request-coercer coercion
type
model
{:reitit.coercion/keys [extract-request-format
parameter-coercion
serialize-failed-result skip]
:or {extract-request-format extract-request-format-default
parameter-coercion default-parameter-coercion
skip #{}}})
(request-coercers coercion parameters opts)
(request-coercers coercion parameters route-request opts)
(response-coercer coercion
{:keys [content body]}
{:keys [extract-response-format serialize-failed-result]
:or {extract-response-format
extract-response-format-default}})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close