Upgrade to Pro — share decks privately, control downloads, hide ads and more …

APIドキュメント標準化現状確認 / standard api document

mat
June 15, 2016

APIドキュメント標準化現状確認 / standard api document

Excite Japan Co., Ltd.
Lightning Talks

mat

June 15, 2016
Tweet

More Decks by mat

Other Decks in Technology

Transcript

  1. { "data": { "id": 3, "title": "هࣄλΠτϧ", "body": "<html>HTMLຊจ</html>", "created_at":

    "2016-05-22T14:56:29.000Z", "updated_at": "2016-05-22T14:56:28.000Z", "author": "author1", "tags": [ {"id": 1, "tag_name": "λά໊1"}, {"id": 2, "tag_name": "λά໊2"} ] } } ྫɿϒϩάهࣄऔಘAPI Ϩεϙϯε(200)
  2. + Request (application/json) + Headers Accept: application/json + Parameters +

    article_id: 3 (number, required) + Response 200 (application/json) + Attributes + data (required) + id: 3 (number, required) + title: هࣄλΠτϧ (string, required) + body: `<html>HTMLຊจ</html>`(string, required) + created_at: `2016-05-22T14:56:29.000Z` (string, required) + updated_at: `2016-05-22T14:56:28.000Z` (string, required) + author: author1 (string, required) -- هࣄຖʹҰਓͷϢʔβʢஶऀʣ + tags (array) -- هࣄຖʹෳ਺ͷλά + (object) + id: 1 (number, required) + tag_name: λά1 (string, required) + (object) + id: 2 (number, required) + tag_name: λά2 (string, required) blog.apib(Ұ෦ൈਮ)
  3. schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity

    representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ࢖༻͠ɺهࣄຖͷauthor,tag৘ใ΋ฦ٫͢Δ blog.raml(Ұ෦)
  4. schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity

    representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ࢖༻͠ɺهࣄຖͷauthor,tag৘ใ΋ฦ٫͢Δ blog.raml(Ұ෦)
  5. schemas: - article: !include sampleblog-include-article.schema resourceTypes: - collection-item: description: Entity

    representing a <<resourcePathName|!singularize>> get: responses: 200: body: application/json: schema: <<resourcePathName|!singularize>> example: | <<exampleItem>> /article: /{article_id}: uriParameters: article_id: description: هࣄID type: integer required: true example: 3 type: collection-item: exampleItem: !include sampleblog-include-article-item.sample description: هࣄ୯ମ get: description: هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ࢖༻͠ɺهࣄຖͷauthor,tag৘ใ΋ฦ٫͢Δ blog.raml(Ұ෦)
  6. swagger: '2.0' host: sampleblog.com basePath: /v1 paths: /article/{article_id}: get: summary:

    هࣄৄࡉ description: | هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ࢖༻͠ɺهࣄຖͷauthor,tag৘ใ΋ฦ٫͢Δ parameters: - name: article_id in: path description: هࣄID required: true type: number tags: - Article responses: 200: description: هࣄৄࡉ schema: $ref: '#/definitions/Article' swagger.yaml(Ұ෦)
  7. swagger: '2.0' host: sampleblog.com basePath: /v1 paths: /article/{article_id}: get: summary:

    هࣄৄࡉ description: | هࣄৄࡉΛऔಘ͢ΔɻهࣄݸผϖʔδͰ࢖༻͠ɺهࣄຖͷauthor,tag৘ใ΋ฦ٫͢Δ parameters: - name: article_id in: path description: هࣄID required: true type: number tags: - Article responses: 200: description: هࣄৄࡉ schema: $ref: '#/definitions/Article' swagger.yaml(Ұ෦)
  8. definitions: Article: type: object required: - id - title -

    body - created_at - updated_at - author - tags properties: id: type: number description: هࣄID title: type: string description: هࣄλΠτϧ body: type: string description: HTMLຊจ created_at: type: string format: datetime description: ࡞੒೔࣌ updated_at: type: string format: datetime description: ߋ৽೔࣌ author: type: string swagger.yaml(ଓ͖,Ұ෦ൈਮ)