Liking cljdoc? Tell your friends :D

martian.core


bootstrapclj/s

(bootstrap api-root concise-handlers & [{:keys [produces consumes] :as opts}])

Creates a Martian instance from the given concise-handlers description.

Supported options:

  • :interceptors — an ordered coll of Tripod interceptors to be used as a global interceptor chain by Martian instance; defaults to the default-interceptors;
  • :validate-handlers? — if true, will enable early validation of handlers, failing fast in case of errors; false by default;
  • :coercion-matcher — a unary fn of schema used for parameters coercion; defaults to the default-coercion-matcher;
  • :produces — a coll of media (content) types used as a global default value for the handler's :produces key;
  • :consumes — a coll of media (content) types used as a global default value for the handler's :consumes key.
Creates a Martian instance from the given `concise-handlers` description.

Supported options:
- `:interceptors`       — an ordered coll of Tripod interceptors to be used
                          as a global interceptor chain by Martian instance;
                          defaults to the `default-interceptors`;
- `:validate-handlers?` — if true, will enable early validation of handlers,
                          failing fast in case of errors; false by default;
- `:coercion-matcher`   — a unary fn of schema used for parameters coercion;
                          defaults to the `default-coercion-matcher`;
- `:produces`           — a coll of media (content) types used as a global
                          default value for the handler's `:produces` key;
- `:consumes`           — a coll of media (content) types used as a global
                          default value for the handler's `:consumes` key.
sourceraw docstring

bootstrap-openapiclj/s

(bootstrap-openapi api-root json & [opts])

Creates a Martian instance from an OpenAPI/Swagger spec based on the json schema provided.

Supported options:

  • :interceptors — an ordered coll of Tripod interceptors to be used as a global interceptor chain by Martian instance; defaults to the default-interceptors;
  • :validate-handlers? — if true, will enable early validation of handlers, failing fast in case of errors; false by default;
  • :coercion-matcher — a unary fn of schema used for parameters coercion; defaults to the default-coercion-matcher;
  • :use-defaults? — if true, will read 'default' directives from the OpenAPI/Swagger spec; false by default.
Creates a Martian instance from an OpenAPI/Swagger spec based on the `json`
schema provided.

Supported options:
- `:interceptors`       — an ordered coll of Tripod interceptors to be used
                          as a global interceptor chain by Martian instance;
                          defaults to the `default-interceptors`;
- `:validate-handlers?` — if true, will enable early validation of handlers,
                          failing fast in case of errors; false by default;
- `:coercion-matcher`   — a unary fn of schema used for parameters coercion;
                          defaults to the `default-coercion-matcher`;
- `:use-defaults?`      — if true, will read 'default' directives from the
                          OpenAPI/Swagger spec; false by default.
sourceraw docstring

bootstrap-swaggerclj/s

(bootstrap-swagger api-root json & [opts])

Creates a Martian instance from an OpenAPI/Swagger spec based on the json schema provided.

Supported options:

  • :interceptors — an ordered coll of Tripod interceptors to be used as a global interceptor chain by Martian instance; defaults to the default-interceptors;
  • :validate-handlers? — if true, will enable early validation of handlers, failing fast in case of errors; false by default;
  • :coercion-matcher — a unary fn of schema used for parameters coercion; defaults to the default-coercion-matcher;
  • :use-defaults? — if true, will read 'default' directives from the OpenAPI/Swagger spec; false by default.
Creates a Martian instance from an OpenAPI/Swagger spec based on the `json`
schema provided.

Supported options:
- `:interceptors`       — an ordered coll of Tripod interceptors to be used
                          as a global interceptor chain by Martian instance;
                          defaults to the `default-interceptors`;
- `:validate-handlers?` — if true, will enable early validation of handlers,
                          failing fast in case of errors; false by default;
- `:coercion-matcher`   — a unary fn of schema used for parameters coercion;
                          defaults to the `default-coercion-matcher`;
- `:use-defaults?`      — if true, will read 'default' directives from the
                          OpenAPI/Swagger spec; false by default.
sourceraw docstring

default-coercion-matcherclj/s

The default coercion matcher used by Martian for parameters coercion.

The default coercion matcher used by Martian for parameters coercion.
sourceraw docstring

default-interceptorsclj/s

The vector with default interceptors used to build a Martian instance.

The vector with default interceptors used to build a Martian instance.
sourceraw docstring

exploreclj/s

(explore martian)
(explore martian route-name)

Explores the given Martian instance or a particular handler with the given route-name, if any.

Returns a map containing details such as:

  • :route-name and :summary — for the Martian instance, or
  • :summary, :parameters, and :returns — for the handler.
Explores the given Martian instance or a particular handler with the given
`route-name`, if any.

Returns a map containing details such as:
- `:route-name` and `:summary` — for the Martian instance, or
- `:summary`, `:parameters`, and `:returns` — for the handler.
sourceraw docstring

handler-forclj/s

(handler-for martian route-name)

Given a Martian instance, returns a handler for the given route-name.

Given a Martian instance, returns a handler for the given `route-name`.
sourceraw docstring

request-forclj/s

(request-for martian route-name)
(request-for martian route-name params)

Given a Martian instance, builds an HTTP request for the given route-name using the provided params, if any.

Given a Martian instance, builds an HTTP request for the given `route-name`
using the provided `params`, if any.
sourceraw docstring

response-forclj/s

(response-for martian route-name)
(response-for martian route-name params)

Given a Martian instance, makes an HTTP request for the given route-name using the provided params, if any, and returns the HTTP response.

Given a Martian instance, makes an HTTP request for the given `route-name`
using the provided `params`, if any, and returns the HTTP response.
sourceraw docstring

update-handlerclj/s

(update-handler martian route-name update-fn & update-args)

Given a Martian instance, updates a handler with the provided route-name using the provided update-fn and update-args, if any.

For example, route-specific interceptors can be added like that:

(update-handler m :load-pet assoc :interceptors [an-interceptor])
Given a Martian instance, updates a handler with the provided `route-name`
using the provided `update-fn` and `update-args`, if any.

For example, route-specific interceptors can be added like that:
```
(update-handler m :load-pet assoc :interceptors [an-interceptor])
```
sourceraw docstring

url-forclj/s

(url-for martian route-name)
(url-for martian route-name params)
(url-for martian route-name params {:keys [include-query?] :as _options})

Given a Martian instance, builds a request URL for the given route-name using the provided params and options, if any.

Supported options:

  • :include-query? — if true, will include params in the URL query string; false by default.
Given a Martian instance, builds a request URL for the given `route-name`
using the provided `params` and options, if any.

Supported options:
- `:include-query?` — if true, will include params in the URL query string;
                      false by default.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close