Operation with request body hint

Hi

I'm splitting this suggestion from the other thread. Forgive the awkward pseudo-yaml, but my webmail ignores leading whitespace.

Currently we can define minimal operation as

operation:
- expects: Something
- method: PUT

I think it would be necessary to allow providing a complete or partial body for a request. There are two possible scenarios here:

1. The server instructs the client what the actual payload is. Period.
2. The server gives the initial representation, so that the client can fill the UI with default values

ad 1. No 'expects'

operation:
- method: PUT
- body:
- - key: value

I would expect this be used for inline operations only. Without any semantics for `key` pair and no `@type` the client has no option other than obediently PUT the representation { "key": "value" }.

ad 2. Both `expects` and `body`

operation:
- expects: BlogPost
- method: PUT
- body:
- - title: "New blog post"

The client would now assume that the `body` object is of type `BlogPost` and fill the form field with the given title.

Please share your thoughts.

Thanks,
Tom

Received on Monday, 14 March 2016 11:46:37 UTC