This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-25
Channels
- # aws (1)
- # beginners (60)
- # boot (12)
- # cider (7)
- # cljs-dev (8)
- # cljsrn (24)
- # clojure (169)
- # clojure-nl (1)
- # clojure-russia (3)
- # clojure-spec (15)
- # clojure-switzerland (1)
- # clojure-uk (24)
- # clojurescript (120)
- # core-async (9)
- # datomic (3)
- # emacs (2)
- # gsoc (3)
- # klipse (2)
- # leiningen (4)
- # numerical-computing (13)
- # off-topic (95)
- # om (7)
- # onyx (1)
- # powderkeg (2)
- # protorepl (2)
- # re-frame (6)
- # reagent (58)
- # ring-swagger (1)
- # rum (28)
- # untangled (42)
- # vim (6)
@don.dwoske Where do you get this data from? Can you use :person/properties
and :house/properties
instead or do you treat ::properties as just a bag of key-value pairs? Or maybe use :properties
without namespace so you can have the same keyword with different specs such as (s/def :person/properties ...)
and then (s/keys :req-un [:person/properties] ...)
.
Or perhaps be strict about a flat structure such as {::id 2, ::type "house" :house/color "red" :house/style "Victorian"}
I’ve got a flat structure working decently now. Your idea to use different namespaces for each properties list is a good one, that should work I think. The spec is used to validate data with unqualified keys, so it fits. I only need the properties
map name to be consistent across all types. We have not yet finalized our design for these payloads, but if I can get the specs working both in flat and nested properties
format, that would be excellent.
BTW, for those interested, I’m building out a proof-of-concept to compare using clojure.spec on an enterprise level to define and validate our entity types vs. something homegrown vs. XSD, vs. JSON Schema vs. Avro vs. whatever else. Barring any setbacks, I may propose using clojure.spec as the place-of-truth for these, and using tools to translate to any other format we may need.
I’d be curious also to know if there is a way to use clojure.spec to define a web API contract and then auto-generate swagger docs from it.
@don.dwoske There's something related here: https://github.com/metosin/spec-tools
And maybe here: https://github.com/mpenet/spex/blob/master/src/clj/qbits/spex/json_schema.clj
@U050SC7SV we are looking at graphql as well - any particular database or libraries in mind?
We use a mix of ES and cassandra, but graphql usage doesnt really depend on a particular datastore. I am experimenting with the lib from Walmartlabs, so far impressed
I thought you could lookup :ret
/`:args` on a spec, e.g. (:ret (s/get-spec 'full/symbol))
but this is just returning nil :thinking_face: