Liking cljdoc? Tell your friends :D

garm.core


->errorclj/s

(->error prob)
source

->json-api-responseclj/s

(->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
sourceraw docstring

->strclj/smultimethod

source

missing-key?clj/s

(missing-key? problem)

Returns true is a given problem is missing key

Returns `true` is a given `problem` is missing key
sourceraw docstring

problem->idclj/s

(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`.
sourceraw docstring

problem->reasonclj/s

(problem->reason problem)

Returns a reason map of a given problem

Returns a `reason` map of a given `problem`
sourceraw docstring

validateclj/s

(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`.
sourceraw docstring

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

× close