Is there a way to generate a ya da server from a swagger definition?
no
How to i tell yada which http status code to return, depending on the request content? Or depending on what error is caught?
I've been looking at this page: https://github.com/juxt/yada/blob/master/doc/responses.adoc
i tried "declaring" a 400 in my handler, and returning {400 "message}, but it just returned a 200 with {400 "message"} as the body
@jholkeboer there's different ways depending on how much control you need
If you follow the happy path of yada, then you never need to explicitly set status codes as it will do it all for you, based on it's understanding of the HTTP spec
e.g. if a form request doesn't pass the Schema then it will return a 400 without you having to do anything
I had to read this a few times to really get it, I would like to make a PR to explain it better
There are three ways to return a response, explicit responses, declared responses, and status responses
Explicit responses let you return the full response from the context (assoc (:response ctx) :status 418)
along with any response you would like
A status response is used for overriding Yada's default responses for a particular status code
So if you would have got a 404 for a particular request, you can override the 404 response with your own response entry
There is a difference between 10.2 Declared responses and 10.3 Status responses, but I can't remember what they are
For you, you probably want to use Schema validation if you can validate the request being bad up front