-
Notifications
You must be signed in to change notification settings - Fork 219
Recursive Schemas Impl #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
TODO: cljs fails on maximum call stack
Recursive schema resolution is too eager now: (m/form
[:and
{:registry {::ping ::pong2
::pong2 ::pong
::pong [:and pos-int?]}}
::ping])
;[:and {:registry {:user/ping [:and pos-int?]
; :user/pong2 [:and pos-int?]
; :user/pong [:and pos-int?]}}
; [:and pos-int?]] , should retain the pointer information. |
(for durable eager schema links)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Left a super nitpicky comment that really doesn't warrant any changes. Code looks really nice, as always.
(defn -map-gen [schema options] | ||
(let [entries (m/map-entries schema) | ||
value-gen (fn [k s] (gen/fmap (fn [v] [k v]) (generator s options))) | ||
options' (-recursion-options schema options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this is better filed as a bug with them, but just worth noting that the "prime" convention isn't well supported in some editors' understanding of the clojure grammar. Emacs will attempt to convert options'
into options '
causing the expression to rebind options
to the quoted expression '(-recursion-options schema options)
.
Displaces impl from #117, which will remain a place to discuss & history. FIxs #20 .
m/Schema
method-children
to get child schemas instances too:multi
implementsm/MapSchma
m/RefSchma
protocol with the following impls::ref
- a lazy reference, enabling recursion:schema
, likem/schema
(entity) but in data, eagermalli.core/schema
, eager schema (value) ref, used internally. if no properties and child is a qualified keyword, derived form from the child:registry
in any elementm/Schema
methods, to support lazinessm/-distance
andm/-lookup
helpersm/from-map-syntax
works with non-map child's (enums, refs)TODO
:schema
for non-lazy references (retains original information):id
:registy
Current syntax:
Initial Syntax:
(support for local recursion removed)