7

是否可以为对某个请求的每个响应指定描述?假设我们有一个请求

### Retrieve resource [GET]

    + Headers

            If-None-Match: "Version1"

和 2 个回应

+ Response 200 (application/xml)

    + Headers

            ETag: "Version2"

    + Body

            <Xml>
                <A>
                    <B />
                    <C />
                </A>
            </Xml>

+ Response 304 (application/xml)

我想在这里指定描述(请在行下方注明注释+ Response):

+ Response 200 (application/xml)
In case if the resource hasn't changed

    + Headers

            ETag: "Version2"

    + Body

            <Xml>
                <A>
                    <B />
                    <C />
                </A>
            </Xml>

+ Response 304 (application/xml)
In case if the resource has changed

可能吗?

4

1 回答 1

8

目前没有办法在 API 蓝图中表达这样的逻辑。您始终可以在相应的响应中或在操作本身下“通过口述”来描述它。例如:

# Resource [/1]

## Action [GET]

Explanation of this action here.

+ Request 

        ...

+ Response 200

    Explanation of this response.

    + Headers

            ...

    + Body

            ...

+ Response 304

    Explanation of this response.

    + Headers

            ...

请注意,在不久的将来很可能会有一些有限的分支支持以支持内容协商。

于 2013-10-17T17:21:48.770 回答