deercreeklabs / lancaster

Apache Avro library for Clojure and ClojureScript
Other
60 stars 5 forks source link

(wait, request for comments) Clojure(Script) spec addition #3

Closed piotr-yuxuan closed 1 year ago

piotr-yuxuan commented 6 years ago

I'm thinking about adding Clojure(Script) support in lancaster as well as you've got Prismatic schemas with deercreeklabs.lancaster.utils/edn-schema->plumatic-schema. This first commit (with no tests) is a bare wireframe for the implementation I'm thinking about.

I'd be more than delighted to get some feedback about that, be it positive or negative. What do you think of the suggested implementation? Anything better / any possible refactoring? Can it work and be useful?

chadharrington commented 6 years ago

Spec support is definitely something I want to add. Your approach looks great and matches the rest of the project well. One minor naming preference: Let's make the top-level function name simply "spec". That matches the rest of the fn names. Usage would be:

(require '[deercreeklabs.lancaster :as l])
(def sch (l/map-schema l/int-schema))
(l/spec sch)

I have held off because I have some complaints about spec's current form. It sounds like some changes are coming to spec that will likely resolve those complaints. Let's wait until we see what spec alpha 2 brings, then implement this.

piotr-yuxuan commented 5 years ago

So I'll wait for changes in spec.

piotr-yuxuan commented 5 years ago

Update: I've written a draft avro->spec project here: https://github.com/piotr-yuxuan/dove. Do you think it could be easily melt into lancaster? Just feel free to criticize it or point out anything I would have missed.

chadharrington commented 5 years ago

Hi Piotr, I am in the process of making some changes to lancaster to make it work better with specs. Once I finish that; I will look more closely at dove and other options for generating specs.

Thanks for your efforts, Chad

chadharrington commented 1 year ago

This PR is out of date; I will close now.