Closed ikitommi closed 6 years ago
How about describing schema in hiccup style
(s/defschema Model
(st/schema
[:type/map {:description "Model description"}
[:size :type/int {:optional true
:default 0 :min 10 :max 20
:description "number 10-20"}]
[:gender :type/enum {:values [:male :female]
:default :male
:description "gender"}]]))
Could be alternative, but it would need to be converted to "real" Schema representation by some function. And we still need the Schemas for min/max etc.
Sure, I meant it as a way to describe schema by end user, like me, who just want's to model api ins and outs. Internally it can be the "real" Schema or whatever.
For web apps, Schemas are used to both validate & document the apis. Would be nice if one could create the schemas more declaratively. There could be a
schema
function in schema-tools that would read declarations (using multimethod dispatch) and create the needed schema structures for those.Something like: