Fork me on GitHub
#yada
<
2016-07-20
>
malcolmsparks11:07:19

@stijn: specifically, the phonebook example uses properties. Essentially properties are your resource's metadata. You tend to grab them from a data source, so you might elect to grab a resource's state too and keep it in the context for the method response function to access. But the resource's state might be large so you might revisit the data source a second time.

stijn11:07:50

yes, I figured it out, it works

stijn11:07:11

I was still using 1.0, so was wondering if it's the same flow / keywords

stijn11:07:15

similar enough 🙂

ijbriscoe11:07:03

Query about :parameters. I'm using a schema to validate the body, and it works fine - if there is a body! If I omit the body, no validation. Is this by design or a bug? I would expect an empty body to result in an error, as (s/validate SomeSchema nil) does

ijbriscoe16:07:26

One more query: I'm implementing a resource with a POST method:

(yada/resource {
                                 :produces    "application/json"
                                 :methods     {
                                               :post {:consumes "application/json"
                                                      :response {}
                                                      }
                                               }})
Even this minimal definition is returning a 200 status, not 201. Is this right? (I've replaced a function that returns a map with {} to simplify the example - the real function saves a new document to ArangoDB, so I want to return 201 to indicate the resource has been created)

malcolmsparks16:07:22

I think it should return a 201 @ijbriscoe

lmergen16:07:28

i'm pretty sure it returns 200 at the moment

lmergen16:07:36

let me see

ijbriscoe16:07:45

It does return 200

ijbriscoe16:07:09

Is there a decent workaround for this? The docs talk about yada getting out of your way, but I've stuggled to change the status in the past - is there a good example I can look at? Didn't see one in Edge - then again, I was only looking at the POST method in the Phonebook resource

lmergen16:07:21

take a look at 'Explicit responses'

lmergen16:07:52

i do think a bug report should be filed for this, though

ijbriscoe16:07:22

Tried that - I've probably done something stupid, but ended up with a nasty exception when I tried to set the status in the response