                     (fn [ky]
                       (document-key parent-typ ky)) all-keys))))))
 
-(defmethod print-error :misspelled-key [{:keys [key corrections orig-error orig-config type-sig] :as error}]
-  (pprint-document (print-path-error error
-                                     (format-key-value
-                                      key
-                                      (format-key key :red)
-                                      (format-value (:value orig-error))
-                                      (str "^ key " (pr-str key) " is spelled wrong"))
-                                     (document-all (first type-sig) corrections))
-                   {:width 40}))
+(defmethod print-error :misspelled-key [{:keys [key corrections orig-error value orig-config type-sig path] :as error}]
+  (let [parent-path (-> path rest reverse)]
+    (pprint-document (print-path-error (error-help-message error)
+                                       parent-path
+                                       ((if (not-empty parent-path) format-map identity)
+                                        (format-key-value
+                                         key
+                                         (format-key key :red)
+                                         (format-value value)
+                                         (str "^ key " (pr-str key) " is spelled wrong")))
+                                       (document-all (first type-sig) corrections))
+                     {:width 40})))
+
+(comment
+  (print-one-error  (index-spec (spec 'RootMap {:wowza (ref-schema 'Nah)})
+                                (spec 'Nah {:nada [string?]})
+                                #_(assert-not-empty 'Nah :a)
+                                #_(requires-keys 'Nah :a))
+                    'RootMap {:wowza {:nad []}})
+  )
 
 (defn print-errors [rules root config]
   (with-schema rules

                  'Some {:a 1 :c 3}
                  :c ))

(defn unknown-key-error-helper [root-type parent-type bad-key value error]
  (let [parent-config-value (error-parent-value error)
        analysis            (detailed-config-analysis parent-config-value)
        actual-parent-type? (analysis-type-matches parent-type analysis)]
    #_(prn root-type actual-parent-type?)
    #_(pprint/pprint analysis)
    #_(if (= bad-key :magicl))
    (if (and (not (true? actual-parent-type?)) (not (nil? (:alternate-type actual-parent-type?))))
      ;; not parent type we are looking at a misplaced configuration
      ;; value
      ;; TODO this is still weak
      [{:Error :wrong-position-for-value
        :current-path (-> error :path rest)
        :expected-type parent-type
        :value parent-config-value
        :path (rest (:path error))
        :actual-type (:alternate-type actual-parent-type?)
        :correct-paths (get-paths-for-type root-type (:alternate-type actual-parent-type?))}]
      ;; now we can determing if this is most likely a mispelled key
      (if-let [mispelled-key-error (misspelled-key? parent-type parent-config-value bad-key analysis)]
        [mispelled-key-error]
        (if-let [misplaced-key-error

                          (if (neg? pos) 100 pos))) res-groups)))

(defn type-check-one-error [root-type value]
  (when-let [results (not-empty (type-checker root-type value {}))]
    (when-let [[[typ errors] & xs] (not-empty (->> results
                                                   (map #(assoc % :orig-config value))
                                                   group-and-sort-first-pass-errors))]
      ;; TODO process one error?
      (when-let [errors (not-empty (doall (handle-type-error-groupp root-type [typ errors])))]
        (when-let [[[typ errors] & xs] (not-empty (->> errors
                                                       (map #(assoc % :orig-config value))
                                                       group-and-sort-first-pass-errors))]
          (first errors))))))

#_(with-schema
  (index-spec
