Skip to content

Instantly share code, notes, and snippets.

@eiel
Created March 3, 2016 00:19
Show Gist options
  • Save eiel/659c9f4e5c9447cf3354 to your computer and use it in GitHub Desktop.
Save eiel/659c9f4e5c9447cf3354 to your computer and use it in GitHub Desktop.
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Example API
description: サンプルドキュメント
version: "1.0.0"
# the domain of the service
host: api.example.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /v1
produces:
- application/json
paths:
/self/home:
get:
summary: 自分の情報
description: |
自分の情報
parameters:
- name: access_token
in: header
type: string
required: true
description: ユーザー情報を示すアクセストークン
tags:
- self
responses:
200:
description: An array of products
schema:
type: array
items:
$ref: '#/definitions/Event'
examples:
application/json:
-
title: 'たいとる'
images:
-
"URL"
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Event:
type: object
properties:
title:
type: string
description: イベント名
images:
type: array
items:
type: string
location:
$ref: '#/definitions/Locoation'
date:
type: array
items:
type: string
time:
type: string
user:
$ref: '#/definitions/User'
Locoation:
type: object
properties:
latitude:
type: number
longitude:
type: number
name:
type: string
User:
type: object
properties:
id:
type: number
name:
type: string
icon:
type: string
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment