Apiary.io の API Blueprint を活用して、HAL+JSON を使用した新しい API を開発しています。ブループリント自体の応答で JSON を使用しています。代わりに MSON の使用への移行をテストしていますが、配列オブジェクトに問題があります。
これが API ブループリント コードです。curies
one を含む配列 (下部に向かって)を除いて、すべてがうまく機能しますobject
。
FORMAT: 1A
# Content API
An API for retrieving content from NBC News Group.
# Group Root resource
The starting point for the Content API.
## Root Resource [/]
### Request root resource [GET]
+ Response 200 (application/hal+json)
+ Attributes (required, object)
+ _links (object) - Linked resources in HAL
+ self (required, object) - Self link to current document
+ href: / (required, string) - URI of this resource
+ profile: `http://domain.com/docs/profiles/root` (required, string) - URI to profile description for this resource
+ `nbng:content` (object) - Link relation to all content
+ href: `http://apiary-mock.com/content` (required, string) - URI to content
+ title: Browse all NBC News Group content (required, string) - title of the link relation
+ `nbcng:publishers` (object) - Link relation to all publishers
+ href: `http://apiary-mock.com/publishers` (required, string) - URI to publishers
+ title: Browse all NBC News Group publishers (required, string) - title of the link relation
+ `nbcng:publisher` (object) - Link relation to an individual publisher
+ href: `http://apiary-mock.com/publisher/{id}` (required, string) - URI to an individual publisher, with `{id}` query string param
+ templated: true (required, boolean) - Notes if the link has a URI template associated to it
+ title: Get a publisher by name (required, string) - title of the link relation
+ curies (required, array) - Link relation to documentation
+ (object)
+ href: `http://www.domain.com/docs/relation/nbcng/{rel}` (required, string) - URI to documentation
+ name: nbcng (required, string) - prefix of the link relation documentation is tied to
+ title: NBC News Group Link Relation (required, string) - title of the link relation
+ templated: true (required, boolean) - Notes if the link has a URI template associated to it
+ welcome: Welcome to the NBC News Group Content API (required, string) - Welcome message for resource
そのcuries
配列に対して、JSON の API ブループリント出力は以下を返します。
"curies": [
{
"undefined": null
}
]
期待されるのは、次のような JSON です。
"curies": [
{
"href": "http://www.nbcnewsdigitaldev.com/docs/relation/nbcng/{rel}",
"name": "nbcng",
"title": "NBC News Group Link Relation",
"templated": true
}
]
MSON 仕様からわかる限り、curies
配列とオブジェクトの構文は正しいです。
同様の MSON 調査を行ったことのある方からのフィードバックをお待ちしております。