Tactical commit before attempting recursive validation

This commit is contained in:
Simon Brooke 2023-01-10 20:36:00 +00:00
parent a185edb9da
commit 440ea003e2
8 changed files with 39 additions and 28 deletions

2
.gitignore vendored
View file

@ -15,3 +15,5 @@ pom.xml.asc
.calva
.clj-kondo
.lsp
docs/samples/

View file

@ -35,6 +35,8 @@ The full range of command-line switches is as follows:
Note, though, that internationalisation files for languages other than British English have not yet been written, and that one is not complete.
Note also that reification is not, at the time of writing, working.
The following severity levels are understood:
0. `info` things which are not actuallys fault, but issues noted during
@ -48,7 +50,6 @@ The following severity levels are understood:
4. `critical` instances where I believe the fault means that
the object cannot be meaningfully processed.
## Examples
...
@ -59,23 +60,12 @@ Full documentation is [here](https://simon-brooke.github.io/dog-and-duck/).
### Bugs
...
### Any Other Sections
### That You Think
### Might be Useful
Many. Ducks like bugs.
## License
Copyright © 2023 FIXME
Copyright © 2023 Simon Brooke
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
This Source Code is made available under GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.
option) any later version.

14
scan-test-docs.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
docs=../dog-and-duck/resources/activitystreams-test-documents/
for file in ${docs}/*.json
do
name=`basename ${file} | sed s/json$/html/`
echo ${name}
java -jar target/uberjar/quack-0.1.0-SNAPSHOT-standalone.jar \
-i ${file} \
-o "docs/samples/${name}" \
-f html
done

View file

@ -34,8 +34,8 @@
(def ^:const stylesheet-url
;; TODO: fix this to github pages before go live
;;"https://simon-brooke.github.io/quack/style.css"
"resources/public/css/style.css")
;;"https://simon-brooke.github.io/quack/css/style.css"
"../css/style.css")
(def cli-options
;; An option with a required argument
@ -120,16 +120,14 @@
[options]
[:div
{:class "text-analysed"}
[:h2 :text-analysed]
[:h2 (get-message :text-analysed)]
[:pre {:class "ft-syntax-highlight"
:data-syntax "javascript"
:data-syntax-theme "bootstrap"
:data-ui-theme "light"}
(with-out-str
(json/pprint
(read-str
(slurp
(:input options)))))]])
(slurp
(:input options)))]])
(defn output-html
[faults options]

View file

@ -419,7 +419,7 @@
:if-invalid [:must :invalid-units]
;; the narrative says that `anyURI`, but actually unless it's a recognised
;; unit the property is useless. These are the units explicitly specified.
:validator (fn [pv] (#{"cm" "feet" "inches" "km" "m" "miles"} pv))}
:validator (fn [pv] (truthy? (#{"cm" "feet" "inches" "km" "m" "miles"} pv)))}
:updated {:functional true
:if-invalid [:must :invalid-updated]
:validator xsd-date-time?}
@ -460,7 +460,7 @@
;; from an 'or-faults' function which did not
;; return faults
(fault-list? r) (concat f r)
(false? r) (list f)
(false? r) f
:else (doall
(warn "Unexpected return value from validator"
{:return r

View file

@ -14,3 +14,10 @@
(vals object-expected-properties))))
found (read-string (slurp (str "resources/i18n/" language ".edn")))]
(sort (remove found tokens))))
;; (def f {:arguments {:reports ({:@context "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html",
;; :id "https://illuminator.local/fault/25785:1673378166063", :type "Fault", :severity :should, :fault :no-context, :narrative "Section 3 of the ActivityPub specification states Implementers SHOULD include the ActivityPub context in their object definitions`."}
;; {:@context "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html",
;; :id "https://illuminator.local/fault/25785:1673378166063", :type "Fault", :severity :minor, :fault :no-id-transient, :narrative "The ActivityPub specification allows objects without `id` fields only if they are intentionally transient; even so it is preferred that the object should have an explicit null id."}
;; ({:@context "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html",
;; :id "https://illuminator.local/fault/25785:1673378166069", :type "Fault", :severity :must, :fault :invalid-type, :narrative "invalid-type"})), :severity :info}})