(->error prob)
(->json-api-response [data explained-data])
Converts a result tuple of validate
function to JSON API errors format.
It returns nil
when the result of validate
function is successful.
https://jsonapi.org/format/#errors
Converts a result tuple of `validate` function to JSON API errors format. It returns `nil` when the result of `validate` function is successful. https://jsonapi.org/format/#errors
(missing-key? problem)
Returns true
is a given problem
is missing key
Returns `true` is a given `problem` is missing key
(problem->id problem)
Returns an :id
of a given problem
, it could return nil
.
It returns a vector
for nested keys, for flat structure return keyword
,
otherwise nil
.
Returns an `:id` of a given `problem`, it could return `nil`. It returns a `vector` for nested keys, for flat structure return `keyword`, otherwise `nil`.
(problem->reason problem)
Returns a reason
map of a given problem
Returns a `reason` map of a given `problem`
(validate spec-model data)
Validates given data
with a given spec-model
. It return a tuple like
[valid-data nil]
if the data
are valid, otherwise it returns
[nil errors-map]
errors-map
looks like:
{:id [{:args [], :id ::specs/must-be-uuid, :message "Must be a UUID"}]
:price [{:args [], :id ::specs/must-be-decimal, :message "Must be a decimal"}]
:qty [{:args [1 10]
:id :garm.specs/must-be-in-range
:message "Must be between %s and %s"}]}]
For nested structures it returns a vector
as an ID instead of keyword
.
Validates given `data` with a given `spec-model`. It return a tuple like `[valid-data nil]` if the `data` are valid, otherwise it returns `[nil errors-map]` `errors-map` looks like: {:id [{:args [], :id ::specs/must-be-uuid, :message "Must be a UUID"}] :price [{:args [], :id ::specs/must-be-decimal, :message "Must be a decimal"}] :qty [{:args [1 10] :id :garm.specs/must-be-in-range :message "Must be between %s and %s"}]}] For nested structures it returns a `vector` as an ID instead of `keyword`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close