Merge remote-tracking branch 'origin/master'

This commit is contained in:
Simon Brooke 2023-01-04 12:30:50 +00:00
commit e3f5078e9b
7 changed files with 165 additions and 15 deletions

View file

@ -29,8 +29,8 @@
(object-faults x type)
(list (object-reference-or-faults x type :critical :expected-collection)
(cond-make-fault-object (integer? (:totalItems x)) :should :no-total-items)
(object-reference-or-faults (:first x) nil :must :no-first-page)
(object-reference-or-faults (:last x) nil :should :no-last-page))))
(object-reference-or-faults (:first x) (str type "Page") :must :no-first-page)
(object-reference-or-faults (:last x) (str type "Page") :should :no-last-page))))
(defn simple-collection-faults
"Return a list of faults found in `x` considered as a non-paged collection
@ -38,11 +38,12 @@
[x type]
(concat-non-empty
(object-faults x type)
(cons
(list (object-reference-or-faults x type :critical :expected-collection)
(cond-make-fault-object (integer? (:totalItems x)) :should :no-total-items)
(concat
(list (cond-make-fault-object (integer? (:totalItems x)) :should :no-total-items)
(cond-make-fault-object (coll? (:items x)) :must :no-items-collection))
(map #(object-reference-or-faults % nil :must :not-object-reference) (:items x)))))
(reduce
concat
(map #(object-reference-or-faults % nil :must :not-object-reference) (:items x))))))
(defn collection-page-faults
"Return a list of faults found in `x` considered as a collection page

View file

@ -189,12 +189,15 @@
(and (coll? tv) (string? acceptable)) ((set tv) acceptable)
(and (coll? tv) (set? acceptable)) (not-empty
(intersection (set tv) acceptable))
:else
(throw (ex-info "Type value or `acceptable` argument not as expected."
{:arguments {:x x
:acceptable acceptable
:severity severity
:token token}})))
(not
(or (string? acceptable)
(set? acceptable))) (throw
(ex-info
"`acceptable` argument not as expected."
{:arguments {:x x
:acceptable acceptable
:severity severity
:token token}})))
(make-fault-object severity token)))))
(defn any-or-faults