    (s/optional-key :allow-methods) (s/conditional fn? ContextFunction :else Keywords)
    (s/optional-key :allow-headers) (s/conditional fn? ContextFunction :else Strings)})
 
+(s/defschema AccessControlValue
+  (merge Realms Cors NamespacedEntries))
+
 (s/defschema AccessControl
-  {(s/optional-key :access-control) (merge Realms Cors NamespacedEntries)})
-
-;; Here is some very tricky code, caused by the necessity to compose a
-;; couple of these 'data macros'. The realm shorthand has to allow the
-;; scheme short-hand to 'carry over', which makes it difficult to find
-;; an approach that preserves schema integrity while decoupling the
-;; data macros from each other. For an explanation of data macros, see
+  {(s/optional-key :access-control) AccessControlValue})
+
+;; Here is some tricky code, caused by the necessity to compose the
+;; 'data macros'. The realm short-hand has to rewrite the data, which
+;; may include the scheme in short or long form, which makes it
+;; difficult to find an approach that preserves schema integrity while
+;; decoupling the data macros from each other. The consequence is that
+;; these mappings have some intimate knowledge of each other's
+;; structure, but the trade-off of more difficult maintenance is
+;; deemed worth it for the value to the user of being able to use
+;; short-hands. For an explanation of data macros, see
 ;; https://blog.juxt.pro/posts/data-macros.html
 
 (def SingleRealmMapping
-  {(merge Realms Cors NamespacedEntries)
+  {AccessControlValue
    (fn [x]
      (if-let [realm (:realm x)]
        (-> x

       x))})

(def SingleSchemeMapping
  {(merge AuthSchemes Authorization NamespacedEntries)
   (fn [x]
     (if (:verify x)
       (-> x

(s/defschema Authorization
  {(s/optional-key :authorization) s/Any})

(s/defschema RealmValue
  (merge AuthSchemes Authorization NamespacedEntries))

(s/defschema Realms
  {(s/optional-key :realms)
   {Realm RealmValue}})

(s/defschema Cors
  {(s/optional-key :allow-origin) (s/conditional fn? (s/=> (s/conditional ifn? #{s/Str} :else s/Str) Context) :else StringSet)
