jackdaw

https://github.com/FundingCircle/jackdaw
jeremy 2018-12-06T00:05:39.031700Z

Naw, I appreciate any opinions and insights. My goal is just educate myself of the options available and their pros and cons.

2018-12-06T01:27:26.032400Z

I would use the Jackdaw EDN serde until you need something better.

dbernal 2018-12-06T22:08:23.034100Z

I have a question around error reporting for schema coercion:

(def +registry+
 (merge jav/+base-schema-type-registry+
        jav/+UUID-type-registry+))

(def schema-type
  (jav/make-coercion-stack
   +registry+))

(defn parse-schema [clj-schema]
  (.parse (Schema$Parser.) ^String (json/write-str clj-schema)))

(def person-schema
  {:type "record"
   :name "PersonSchema"
   :fields [{:type [{:type "record"
                     :name "value"
                     :fields [{:type "long" :name "age"}]}]
             :name "person"}]})

(jav/clj->avro (schema-type (parse-schema person-schema)) {:person {}} []) --> throws an ExceptionInfo clojure.lang.PersistentArrayMap is not a valid type for union [RECORD]  clojure.core/ex-info (core.clj:4739)

(def person-schema-no-union
  {:type "record"
   :name "PersonSchema"
   :fields [{:type {:type "record"
                    :name "value"
                    :fields [{:type "long" :name "age"}]}
             :name "person"}]})

(jav/clj->avro (schema-type (parse-schema person-schema)) {:person {}} []) --> throws an AvroRuntimeException Field age type:LONG pos:0 not set and has no default value  org.apache.avro.generic.GenericData.getDefaultValue (GenericData.java:984)
For union types there is less information returned that would be useful to decipher what is wrong with the clj map passed in. Would it be useful to have UnionTypes return an error response more similar to the second coercion?

2018-12-07T18:56:33.001700Z

Probably.