diff --git a/src/dog_and_duck/quack/picky/constants.clj b/src/dog_and_duck/quack/picky/constants.clj index f956838..149cef1 100644 --- a/src/dog_and_duck/quack/picky/constants.clj +++ b/src/dog_and_duck/quack/picky/constants.clj @@ -19,7 +19,11 @@ (def ^:const activitystreams-context-uri "The URI of the context of an ActivityStreams object is expected to be this - literal string." + literal string. + + **NOTE THAT** the URI actually used in the published suite of + activitystreams-test-documents use this URI with 'http' rather than + 'https' as the property part, but the spec itself specifies 'https'." "https://www.w3.org/ns/activitystreams") (def ^:const actor-types diff --git a/src/dog_and_duck/quack/picky/scratch.clj b/src/dog_and_duck/quack/picky/scratch.clj index b2f1e0d..30550d9 100644 --- a/src/dog_and_duck/quack/picky/scratch.clj +++ b/src/dog_and_duck/quack/picky/scratch.clj @@ -4,17 +4,24 @@ [clojure.java.io :refer [file]] [clojure.walk :refer [keywordize-keys]] [dog-and-duck.quack.picky.objects :refer - [object-faults]] - [dog-and-duck.quack.picky.utils :refer [concat-non-empty]])) + [object-faults properties-faults]] + [dog-and-duck.quack.picky.utils :refer [concat-non-empty + filter-severity]])) + +(def files (filter + #(and (.isFile %) (.endsWith (.getName %) ".json")) + (file-seq (file "resources/activitystreams-test-documents")))) (def r (remove - nil? + empty? (map #(try (let [contents (read-str (slurp %)) - faults (cond (map? contents) (object-faults - (keywordize-keys contents)) + faults (cond (map? contents) (filter-severity + (object-faults + (keywordize-keys contents)) + :should) ;; (coll? contents) (apply ;; concat-non-empty ;; (map (fn [obj] @@ -22,7 +29,7 @@ ;; (keywordize-keys obj))) ;; contents)) )] - (when-not (nil? faults) + (when-not (empty? faults) [(.getName %) faults])) (catch Exception any [(.getName %) (str "Exception " @@ -32,3 +39,13 @@ (filter #(and (.isFile %) (.endsWith (.getName %) ".json")) (file-seq (file "resources/activitystreams-test-documents")))))) + +(count (filter-severity (object-faults (keywordize-keys (read-str (slurp "resources/activitystreams-test-documents/vocabulary-ex189-jsonld.json")))) :critical)) + +(count (filter + #(and (.isFile %) (.endsWith (.getName %) ".json")) + (file-seq (file "resources/activitystreams-test-documents")))) + +(count r) +(last r) +(clojure.pprint/pprint (last r)) \ No newline at end of file