This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-11
Channels
- # announcements (1)
- # beginners (84)
- # boot (325)
- # cbus (1)
- # cider (13)
- # cljs-dev (1)
- # cljsjs (1)
- # cljsrn (15)
- # clojars (8)
- # clojure (221)
- # clojure-czech (2)
- # clojure-ireland (8)
- # clojure-madison (28)
- # clojure-poland (176)
- # clojure-russia (111)
- # clojurebridge (7)
- # clojurescript (75)
- # community-development (70)
- # conf-proposals (19)
- # core-async (29)
- # css (12)
- # cursive (66)
- # datavis (15)
- # datomic (61)
- # devcards (15)
- # dirac (2)
- # editors (13)
- # emacs (9)
- # funcool (7)
- # hoplon (13)
- # jobs-discuss (5)
- # ldnclj (39)
- # ldnproclodo (1)
- # lein-figwheel (3)
- # leiningen (21)
- # liberator (26)
- # off-topic (12)
- # om (153)
- # onyx (168)
- # parinfer (165)
- # proton (21)
- # quil (5)
- # re-frame (58)
- # reagent (4)
- # ring-swagger (12)
- # spacemacs (3)
- # yada (120)
@bitsai: Thanks a lot! I will try this
@sreenath.n: actually, i'm sorry, i think i mis-spoke; based on the list of supported Schema elements on this page: https://github.com/metosin/ring-swagger
@bitsai: Hmmm.. I see. I had parked this to try it out later. Anyways, thanks again
@bitsai: @sreenath.n: Pred has very rough support, if predicate name is one of these three it works: https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/json_schema.clj#L99-L101
JSON Schema doesn't really allow describing more complex cases
But, if you know how you want to describe the predicate in JSON Schema, you can use field
to manually set JSON Schema fields: https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/json_schema.clj#L32-L40
Something like (field (s/pred foobar?) {:type "string" :pattern "sdfsdf"})
@bitsai @juhoteperi : Right now I am building an api for our internal team to consume. So, we can live with the validation error messages. But, I am trying to figure out how can I use this for a much broader audience. We will need support for better error messages. I though https://github.com/metosin/ring-swagger#adding-description-to-schemas might help, but it did not ๐
One thing for better error messages would be not to squash errors into a string (https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/middleware.clj#L50), but to keep them as vectors, symbols and values.