Naming/define a collection of clojure.spec/keys with 1 namespace-keyword (s/def ::xxx (s/keys [....])
, results on the endless types (Maybe Not) problem.
The approach proposed in this lib, uses a compound-identity (semantic-namespace.spec.keys/def #{::xxx ::yyy} [....])
with just the collection of spec-keys, to define clojure.spec/keys based on any combination of namespace-keywords.
Example:
(require '[semantic-namespace.spec.keys :as spec.keys]
'[clojure.spec.alpha :as s])
(s/def ::id string?)
(s/def ::alias string?)
(spec.keys/def
#{:app.api.endpoint.get/response
:app.domain/user}
[::id ::alias])
;;
(spec.keys/valid?
#{:app.api.endpoint.get/response
:app.domain/user}
{::id "foo" ::alias "@foo"})
;;=> true
(spec.keys/valid?
#{:app.api.endpoint.get/response
:app.domain/user}
{::id "foo" ::alias 55})
;;=> false
(spec.keys/valid?
#{:app.api.endpoint.get/response
:app.domain/user}
{::id "foo" ::emal "foo@foo"})
;;=> false
https://clojars.org/com.github.semantic-namespace/spec.keys
https://github.com/semantic-namespace/spec.keys/blob/main/test/semantic_namespace/spec/keys_test.clj