Ring-swagger Api Documentation

Version: 0.22.3

ring.swagger.swagger2

convert-operation

(convert-operation operation options)

Returns a map with methods as keys and the Operation maps with parameters and responses transformed to comply with Swagger spec as values

convert-parameters

(convert-parameters parameters options)

convert-responses

(convert-responses responses options)

ensure-body-and-response-schema-names

(ensure-body-and-response-schema-names swagger)

Takes a ring-swagger spec and returns a new version with a generated names for all anonymous nested schemas that come as body parameters or response models.

ensure-body-sub-schemas

(ensure-body-sub-schemas route)

ensure-response-sub-schemas

(ensure-response-sub-schemas route)

extract-models

(extract-models swagger)

extract-paths-and-definitions

(extract-paths-and-definitions swagger options)

swagger-json

(swagger-json swagger)(swagger-json swagger options)

Inputs: ([swagger :- (s/maybe Swagger)] [swagger :- (s/maybe Swagger) options :- (s/maybe Options)])

Produces swagger-json output from ring-swagger spec. Optional second argument is a options map, supporting the following options with defaults:

:ignore-missing-mappings? - (false) boolean whether to silently ignore missing schema to JSON Schema mappings. if set to false, IllegalArgumentException is thrown if a Schema can’t be presented as JSON Schema.

:default-response-description-fn - ((constantly "")) - a fn to generate default response descriptions from http status code. Takes a status code (Int) and returns a String.

:handle-duplicate-schemas-fn - (ring.swagger.core/ignore-duplicate-schemas), a function to handle possible duplicate schema definitions. Takes schema-name and set of found attached schema values as parameters. Returns sequence of schema-name and selected schema value.

:collection-format - Sets the collectionFormat for query and formData parameters. Possible values: multi, ssv, csv, tsv, pipes.

swagger-path

(swagger-path uri)

Replaces Compojure/Clout style path params in uri with Swagger style path params.

Does not support wildcard-paths or inline-regexes.

The regex is copied from Clout.

transform

(transform schema)

transform-models

(transform-models schemas options)

transform-operations

(transform-operations f swagger)

Transforms the operations under the :paths of a ring-swagger spec by applying (f operation) to all operations. If the function returns nil, the given operation is removed.