apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.64k stars 2.14k forks source link

Response headers when using +Model #322

Closed gdombiak closed 8 years ago

gdombiak commented 8 years ago

I'm using +Model to define what my resource is and then in the actions I reference my model. Here is an example of my resource

## Store [/stores]

+ Model (application/json)

    + Body

            {
                "id": "1234",
                "name": "My Store"

            }

    + Schema

            {
                Some JSON Schema
            }

Here we see an example of a PUT operation:

### Update Store [PUT /stores/{id}]

+ Parameters
    + id (string, required) - The identifiers for the schema .

+ Request

    [Store][]

+ Response 200

    [Store][]

The PUT request will include If-None-Match header and the response will include ETag header. Is it possible to specify request headers and response headers when using models?

Thanks, Gaston

pksunkara commented 8 years ago

I think you can use Attributes if you want to make the request and responses DRY but still have the capacity to add Headers.

Resource Model is a concept which is limited about what it can do.

gdombiak commented 8 years ago

Thanks for the response. I will explore the option of using 'includes' then. Not as strong as expressing what is the model of a resource but at least I can define the model in one place.