4

The “model” facility seems intended to reduce duplication — when specifying the requests and responses to various methods on a resource, the same body will frequently be specified multiple times. So one can define a “model” and then “refer” to it within various request and response “payload” sections.

So I’ve defined a model like so:

### An Event

* Model (application/vnd.document+json)

            {
                "_type": "document",
                ...
            }     

and I can then refer to it in various places:

* Response 200

    [An Event][]

which works great; the output includes the entire model body in place of the cross-reference.

However, I can’t figure out how to combine this reference with a request or response header.

I’ve tried various formats along these lines:

* Request

    * Headers

            If-Match: some-etag-value

    * Body

            [An Event][]

or

* Request

    * Headers

            If-Match: some-etag-value

    [An Event][]

with no luck.

Is there any way to do this?

4

1 回答 1

2

当前无法更改引用模型的有效负载。在任何API Blueprint Milestones中都没有计划。

如果愿意,请随意将其添加到里程碑并提出其语法。在这样做之前,请考虑与计划中的API Blueprint Object Traits的任何潜在协同作用。

于 2013-12-27T18:10:49.087 回答