Liking cljdoc? Tell your friends :D

nl.jomco.openapi.v3.validator


interaction-validatorclj

(interaction-validator {:keys [uri-prefix specification] :as context})

Create an interaction (request/response pair) validator for context.

Takes a context that can be created by calling validator-context.

The request validator is a function that takes a map of :request and the corresponding :response, and returns a collection of issue maps.

If the request matches an operation in the context, and no issues are found in the response or request, the validator returns nil.

Otherwise, returns a collection of issue maps.

Create an interaction (request/response pair) validator for `context`.

Takes a `context` that can be created by calling `validator-context`.

The request validator is a function that takes a map of `:request`
and the corresponding `:response`, and returns a collection of issue
maps.

If the request matches an operation in the `context`, and no issues
are found in the response or request, the validator returns `nil`.

Otherwise, returns a collection of issue maps.
sourceraw docstring

request-validatorclj

(request-validator {:keys [uri-prefix specification] :as context})

Create a request validator for context.

Takes a context that can be created by calling validator-context.

The request validator is a function that takes a ring request map and returns a collection of issue maps. If no issues are found, the validator returns nil.

Create a request validator for `context`.

Takes a `context` that can be created by calling `validator-context`.

The request validator is a function that takes a ring request map
and returns a collection of issue maps. If no issues are found, the
validator returns `nil`.
sourceraw docstring

response-validatorclj

(response-validator {:keys [uri-prefix specification] :as context})

Create a response validator for context.

Takes a context that can be created by calling validator-context.

The request validator is a function that takes a map of :request and the corresponding :response, and returns a collection of issue maps.

If the request matches an operation in the context, and no issues are found in the response, the validator returns nil.

If the request does not match an operation in the context, returns an "uri-error" or "method-error" issue. Does not validate other aspects of the request. Use interaction-validator to fully validate request and response.

Create a response validator for `context`.

Takes a `context` that can be created by calling `validator-context`.

The request validator is a function that takes a map of `:request`
and the corresponding `:response`, and returns a collection of issue
maps.

If the request matches an operation in the `context`, and no issues
are found in the response, the validator returns `nil`.

If the request does not match an operation in the `context`, returns
an "uri-error" or "method-error" issue. Does not validate other
aspects of the request. Use `interaction-validator` to fully
validate request and response.
sourceraw docstring

validator-contextclj

(validator-context specification opts)

Create a new validator context from the given specification.

opts is a map of options (or nil).

Available options:

  • :format-predicates - A map of JSON Schema format values to predicates. When provided, validates instances according to the format predicates. Default is nil; meaning format does no validation. Use nl.jomco.openapi.v3.validator.json-schema-validator/format-predicates to enable validation of format specs.

  • :numeric-coercion - A function to coerce collections and scalars for comparing validations (enum, const, multiple-of and unique). Default is nl.jomco.openapi.v4.validator.json-coerce/json-coerce, which treats all numbers as BigDecimals (so instance 10.0 is valid according to {"const": 10}. Use identity to use Clojure semantics (where instance [1, 1.0] is valid according to {"uniqueItems": true}).

  • uri-prefix - if provided, the base path of the API endpoint to validate. If not provided, the path of the API is assumed to be /.

Create a new validator context from the given `specification`.

`opts` is a map of options (or nil).

Available options:

 - `:format-predicates` - A map of JSON Schema `format` values to
   predicates. When provided, validates instances according to the
   format predicates.  Default is `nil`; meaning `format` does no
   validation.  Use
   `nl.jomco.openapi.v3.validator.json-schema-validator/format-predicates`
   to enable validation of format specs.

 - `:numeric-coercion` - A function to coerce collections and scalars
   for comparing validations (enum, const, multiple-of and
   unique). Default is
   `nl.jomco.openapi.v4.validator.json-coerce/json-coerce`, which
   treats all numbers as BigDecimals (so instance `10.0` is valid
   according to `{"const": 10}`. Use `identity` to use Clojure
   semantics (where instance `[1, 1.0]` is valid according to
   `{"uniqueItems": true}`).

 - `uri-prefix` - if provided, the base path of the API endpoint to
   validate. If not provided, the path of the API is assumed to be `/`.
sourceraw docstring

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

× close