Fork me on GitHub
#yada
<
2016-10-06
>
kurt-yagram07:10:20

Out of curiosity: yada is using Prismatic Schema... 1/ how to handle custom predicates (if possible at all)? For example, if I want to make sure something is a valid UUID, I have a function valid-uuid?. However, using this function:

error converting to swagger schema [:message predicate$valid_uuid_QMARK_@7e7f769]
which makes sense, but can I make this valid (like: show it as a String on the front-end, validate it as UUID in the backend)? 2/ Are there any plans (in the near, or far future 🙂 ) to have a clojure.spec version of yada?

ikitommi07:10:25

@kurt-yagram there is the s/Uuid and you can use custom predicates with s/constrained, like (s/constrained s/Str valid-uuid?). Ring-swagger grabs the type from the first argument (rules here: https://github.com/metosin/ring-swagger#out-of-the-box-supported-schema-elements). Related - there is a open clojure hacking session here in Finland tomorrow, one goal is to get the spec->json-schema finalized & spec runtime coercions to work properly. Will be pushed to ring-swagger.

malcolmsparks07:10:44

Hi @kurt-yagram - I've had a similar issue recently wanting a parameter to be a (base64) string for json, but binary data for multipart/form-data.

malcolmsparks07:10:08

2. Yes, the plan is to adopt clojure.spec quite soon. Ring-swagger is already well on the way, which is where yada gets much of its swagger support from.

kurt-yagram07:10:44

That's wicket-awesome. Thx @ikitommi @malcolmsparks .

jsyrjala09:10:17

How to return custom headers with yada/resource?

jsyrjala10:10:18

Is that the right/recommended way to add headers?

kurt-yagram14:10:05

Is it possible to define a set of values that are valid in swagger? I mean, I tried something like: {:parameters {:path {:par #{"val1", "val2"}}}, hoping that in swagger, I would get a dropdown list of values. This doesn't seem to work, though...

frozenlock14:10:23

Is it possible to update a running Yada listener with new routes?

malcolmsparks14:10:51

It's possible, but you'd have to write your own dynamic equivalent of bidi's find-handler

frozenlock14:10:15

I'll take a look into that. Thanks!

kurt-yagram15:10:29

cool, that does the trick

lmergen16:10:34

hey guys, there is some internal yada error it seems that it renders a 500 error if you send any Accept-Charset header at all

lmergen16:10:56

it can be reproduced by issueing curl -gv '' -H 'Accept-Charset: utf-8’

lmergen16:10:39

since we don't do anything special with charsets (other than telling yada we accept /), does this hint at an actual bug in yada ?

lmergen16:10:51

looking at the exception, it looks like it tries to coerce something into UTF8 that returns nil, and tries to coerce that into json?

malcolmsparks21:10:40

Yes, it looks like a bug.

malcolmsparks21:10:42

Sorry for the poor response, I've been at a conference all day