diff --git a/src/alumbra/spec/analyzed_schema.clj b/src/alumbra/spec/analyzed_schema.clj index d71ae12..dcb7176 100644 --- a/src/alumbra/spec/analyzed_schema.clj +++ b/src/alumbra/spec/analyzed_schema.clj @@ -1,7 +1,7 @@ (ns alumbra.spec.analyzed-schema (:require [clojure.spec :as s] [clojure.spec.gen :as gen] - [alumbra.spec common])) + [alumbra.spec type-description common])) ;; ## Names @@ -90,23 +90,7 @@ ;; value is nested. (s/keys :req-un [:alumbra/type-name :alumbra/non-null? - ::type-description])) - -(s/def ::type-description - (s/with-gen - (s/or :unnested ::unnested - :nested ::nested) - #(gen/frequency - [[9 (s/gen ::unnested)] - [1 (gen/bind (gen/return nil) (fn [_] (s/gen ::nested)))]]))) - -(s/def ::nested - (s/keys :req-un [:alumbra/non-null? - ::type-description])) - -(s/def ::unnested - (s/keys :req-un [:alumbra/non-null? - :alumbra/type-name])) + :alumbra/type-description])) ;; ### Interfaces diff --git a/src/alumbra/spec/type_description.clj b/src/alumbra/spec/type_description.clj new file mode 100644 index 0000000..e4d0438 --- /dev/null +++ b/src/alumbra/spec/type_description.clj @@ -0,0 +1,20 @@ +(ns alumbra.spec.type-description + (:require [clojure.spec :as s] + [clojure.spec.gen :as gen] + [alumbra.spec common])) + +(s/def :alumbra/type-description + (s/with-gen + (s/or :unnested ::unnested + :nested ::nested) + #(gen/frequency + [[9 (s/gen ::unnested)] + [1 (gen/bind (gen/return nil) (fn [_] (s/gen ::nested)))]]))) + +(s/def ::nested + (s/keys :req-un [:alumbra/non-null? + :alumbra/type-description])) + +(s/def ::unnested + (s/keys :req-un [:alumbra/non-null? + :alumbra/type-name])) diff --git a/src/alumbra/spec/validation_errors.clj b/src/alumbra/spec/validation_errors.clj index 3fd8174..d061390 100644 --- a/src/alumbra/spec/validation_errors.clj +++ b/src/alumbra/spec/validation_errors.clj @@ -1,6 +1,6 @@ (ns alumbra.spec.validation-errors (:require [clojure.spec :as s] - [alumbra.spec common])) + [alumbra.spec common type-description])) ;; ## Error Container