Liking cljdoc? Tell your friends :D

coattail.ring


make-method-routesclj/s

(make-method-routes handlers
                    path-subdoc
                    openapi-document
                    {:keys [openapi-toolbox openapi-method->route-method
                            openapi-param-name->path-param-key]
                     :or {openapi-toolbox u/openapi-toolbox
                          openapi-method->route-method keyword
                          openapi-param-name->path-param-key keyword}
                     :as options})

Given a map of the form

{method method-subdoc}

where

  • method is HTTP method as a lowercase string
  • method-subdoc is OpenAPI sub-document on the endpoint details return a vector of route maps:
[{:method  method
  :id      endpoint-id
  :handler endpoint-handler}
 ...]

See: [[todo]]

Given a map of the form
  ```
  {method method-subdoc}
  ```
where
  - `method`        is HTTP method as a lowercase string
  - `method-subdoc` is OpenAPI sub-document on the endpoint details
return a vector of route maps:
  ```
  [{:method  method
    :id      endpoint-id
    :handler endpoint-handler}
   ...]
  ```
See: [[todo]]
sourceraw docstring

make-params-middlewareclj/s

(make-params-middleware ring-request-key
                        openapi-param->path-param
                        param-schema-map
                        openapi-document
                        openapi-toolbox)

Given a map of the form

{param-key schema}

return a Ring middleware to validate and supply (default) parameters.

Given a map of the form
  ```
  {param-key schema}
  ```
return a Ring middleware to validate and supply (default) parameters.
sourceraw docstring

make-request-body-middlewareclj/s

(make-request-body-middleware content-handlers openapi-document openapi-toolbox)

Given a map of the form

{content-type {:parser content-parser
               :schema content-schema}}

where

  • content-type is a Ring request HTTP header
  • content-parser is (fn [raw-body]) -> body-content
  • content-schema is OpenAPI schema return a Ring middleware that parses request body, validates/transforms and processes it.
Given a map of the form
  ```
  {content-type {:parser content-parser
                 :schema content-schema}}
  ```
where
  - `content-type` is a Ring request HTTP header
  - `content-parser` is `(fn [raw-body]) -> body-content`
  - `content-schema` is OpenAPI schema
return a Ring middleware that parses request body, validates/transforms and processes it.
sourceraw docstring

make-response-middlewareclj/s

(make-response-middleware responses-subdoc openapi-document openapi-toolbox)
sourceraw docstring

make-response-operatorsclj/s

(make-response-operators responses-subdoc openapi-document openapi-toolbox)

Given OpenAPI responses sub-document, return a map of status codes to maps {content-type operators} as follows:

{200      {"application/json" {; :tformat-writer turns :data items into type-formatted :data items
                                 :tformat-writer fw1  :default tree1  :content-writer cw1}
           "application/xml"  {:tformat-writer fw2  :default tree2  :content-writer cw2}}
 :default {}}
Given OpenAPI responses sub-document, return a map of status codes to maps {content-type operators} as follows:
```
{200      {"application/json" {; :tformat-writer turns :data items into type-formatted :data items
                                 :tformat-writer fw1  :default tree1  :content-writer cw1}
           "application/xml"  {:tformat-writer fw2  :default tree2  :content-writer cw2}}
 :default {}}
```
sourceraw docstring

make-routesclj/s

(make-routes handlers openapi-document)
(make-routes handlers
             openapi-document
             {:keys [openapi-toolbox openapi-method->route-method
                     openapi-param-name->path-param-key]
              :or {openapi-toolbox u/openapi-toolbox
                   openapi-method->route-method keyword
                   openapi-param-name->path-param-key keyword}
              :as options})
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close