0

Apiary で RESPONSE を再利用する方法はありますか? データ構造は正しい方法ではないと思いますが、他に何も見つかりません...

4

1 に答える 1

0

データ構造 - 最初は少しやり過ぎに見えることに気付いたかもしれませんが、それはあなたが探している正確な答えです. 「高度なモード」でそれらを使用する方法にもっと興味がある場合は、https://github.com/apiaryio/api-blueprint/blob/master/Advanced%20Tutorial.md#data-のチュートリアルをご覧ください。構造物

もう 1 つのオプションは、リソース モデルを使用することです。

## My Message [/message]

+ Model (application/vnd.siren+json)

    This is the `application/vnd.siren+json` message resource representation.

    + Headers

            Location: http://api.acme.com/message

    + Body

            {
              "class": [ "message" ],
              "properties": {
                    "message": "Hello World!"
              },
              "links": [
                    { "rel": "self" , "href": "/message" }
              ]
            }

プレーン属性を使用する他のオプション ( https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#resource-attributes-description )

# Blog Post [/posts/{id}]
Resource representing **ACME Blog** posts.

+ Attributes
    + id (number)
    + message (string) - The blog post article
    + author: john@appleseed.com (string) - Author of the blog post

そして後で参照してください^^^ 以下に書かれているように「アセット」:

+ Attributes (Blog Post)
于 2016-10-01T09:43:18.977 に答える