Fork me on GitHub
#ring-swagger
<
2016-02-11
>
sreenath.n02:02:45

@bitsai: Thanks a lot! I will try this simple_smile

bitsai06:02:27

@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

bitsai06:02:43

... i don't think (pred) is one of the supported Schema elements ๐Ÿ˜•

sreenath.n07:02:44

@bitsai: Hmmm.. I see. I had parked this to try it out later. Anyways, thanks again simple_smile

juhoteperi09:02:05

JSON Schema doesn't really allow describing more complex cases

juhoteperi09:02:46

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

juhoteperi09:02:09

Something like (field (s/pred foobar?) {:type "string" :pattern "sdfsdf"})

sreenath.n09:02:03

@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 ๐Ÿ˜ž

ikitommi13:02:31

Yes, we need easy way to add custom stuff to schemas, examples included.

ikitommi13:02:06

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.