OK, this actually *is* working...

At least partly. Faults are found in all of the documents in the activitystreams-test-documents suite, but this is because

1. five have no `@context` value;
2. the remaining two hundred all consistently use 'http' as the protocol part of the `@context` URI, but the specification requires `https`...

I am picking up other faults and some (perhaps all) of these may be errors in my code rather than in the test documents, but I am heading in the right direction.
This commit is contained in:
Simon Brooke 2023-01-08 22:29:55 +00:00
parent 98e3c7b4e7
commit 2893d83c15
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
2 changed files with 28 additions and 7 deletions

View file

@ -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

View file

@ -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
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))