             [abracad.avro.util :refer [returning mangle unmangle]])
   (:import [java.io ByteArrayOutputStream InputStream EOFException]
            [clojure.lang Named]
-           [org.apache.avro Schema Schema$Parser]
+           [org.apache.avro Schema Schema$Parser Schema$Type]
            [org.apache.avro.file CodecFactory DataFileWriter DataFileReader]
            [org.apache.avro.io
              DatumReader DatumWriter Decoder DecoderFactory

(defn ^:private raw-schema?
  "True if schema `source` should be parsed as-is."
  [source] (or (string? source) (instance? InputStream source)))

(defn parse-schema
  "Parse Avro schemas in `sources`.  Each schema source may be a JSON

    (reduce (fn [_ source]
              (if (instance? Schema source)
                (returning source
                  (when (named-schema? source)
                    (.addTypes parser {(.getFullName ^Schema source) source})))
                (->> (if (raw-schema? source) source (clj->json source))
                     (.parse parser))))
            nil
