Skip to content

Instantly share code, notes, and snippets.

@eiel
Last active March 11, 2016 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiel/87caeace3e4250af94b2 to your computer and use it in GitHub Desktop.
Save eiel/87caeace3e4250af94b2 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: ImageMap API
description: ImageMapa APIドキュメント
version: "1.0.0"
# the domain of the service
host: localhost:3000
# array of all schemes that your API supports
schemes:
- http
# will be prefixed to all paths
basePath: /v0.1
produces:
- application/json
paths:
/search/{latitude},{longitude}:
get:
summary: 特定位置から画像を検索
description: |
指定した緯度と経度から近くにある画像を検索します。
parameters:
- name: latitude
in: path
type: number
required: true
- name: longitude
in: path
type: number
required: true
responses:
200:
description: An array of products
schema:
type: object
properties:
images:
type: array
items:
$ref: '#/definitions/Image'
examples:
application/json:
images:
-
image_id: 1
meter: 100
meter_symbol: 'm'
target_position:
latitude: 1.1
longitude: 2.2
position:
latitude: 2.3
longitude: 3.4
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Point:
type: object
properties:
latitude:
type: number
longitude:
type: number
Image:
type: object
properties:
image_id:
type: number
description: 画像ID
meter:
type: number
meter_synbol:
type: string
position:
$ref: '#/definitions/Point'
base_position:
$ref: '#/definitions/Point'
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