# dog_and_duck/quack/picky/constants.clj

001 (ns dog-and-duck.quack.picky.constants
002 "Constants supporting the picky validator.")
003
004 ;;; Copyright (C) Simon Brooke, 2022
005
006 ;;; This program is free software; you can redistribute it and/or
007 ;;; modify it under the terms of the GNU General Public License
008 ;;; as published by the Free Software Foundation; either version 2
009 ;;; of the License, or (at your option) any later version.
010
011 ;;; This program is distributed in the hope that it will be useful,
012 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
013 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 ;;; GNU General Public License for more details.
015
016 ;;; You should have received a copy of the GNU General Public License
017 ;;; along with this program; if not, write to the Free Software
018 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
019
020 (def ^:const activitystreams-context-uri
021 "The URI of the context of an ActivityStreams object is expected to be this
022 literal string."
023 "https://www.w3.org/ns/activitystreams")
024
025 (def ^:const actor-types
026 "The set of types we will accept as actors.
027
028 There's an [explicit set of allowed actor types]
029 (https://www.w3.org/TR/activitystreams-vocabulary/#actor-types)."
030 #{"Application"
031 "Group"
032 "Organization"
033 "Person"
034 "Service"})
035
036 (def ^:const context-key
037 "The Clojure reader barfs on `:@context`, although it is in principle a valid
038 keyword. So we'll make it once, here, to make the code more performant and
039 easier to read."
040 (keyword "@context"))
041
042 (def ^:const severity
043 "Severity of faults found, as follows:
044
045 0. `:info` not actually a fault, but an issue noted during validation;
046 1. `:minor` things which I consider to be faults, but which
047 don't actually breach the spec;
048 2. `:should` instances where the spec says something SHOULD
049 be done, which isn't;
050 3. `:must` instances where the spec says something MUST
051 be done, which isn't;
052 4. `:critical` instances where I believe the fault means that
053 the object cannot be meaningfully processed."
054 #{:info :minor :should :must :critical})
055
056 (def ^:const severity-filters
057 "Hack for implementing a severity hierarchy"
058 {:all #{}
059 :info #{}
060 :minor #{:info}
061 :should #{:info :minor}
062 :must #{:info :minor :should}
063 :critical severity})
064
065 (def ^:const validation-fault-context-uri
066 "The URI of the context of a validation fault report object shall be this
067 literal string."
068 "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html")
069
070 (def ^:const verb-types
071 "The set of types we will accept as verbs.
072
073 There's an [explicit set of allowed verb types]
074 (https://www.w3.org/TR/activitystreams-vocabulary/#activity-types)."
075 #{"Accept" "Add" "Announce" "Arrive" "Block" "Create" "Delete" "Dislike"
076 "Flag" "Follow" "Ignore" "Invite" "Join" "Leave" "Like" "Listen" "Move"
077 "Offer" "Question" "Reject" "Read" "Remove" "TentativeAccept"
078 "TentativeReject" "Travel" "Undo" "Update" "View"})
079