Skip to content

Instantly share code, notes, and snippets.

@summer-wu
Last active August 29, 2015 14:24
Show Gist options
  • Save summer-wu/beb099aecea7f05e8f82 to your computer and use it in GitHub Desktop.
Save summer-wu/beb099aecea7f05e8f82 to your computer and use it in GitHub Desktop.
swaggerTest.yaml
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Jiaolian API
description: 叫练B端API
version: "1.0.0"
# the domain of the service
host: test.jiaolian.com
# array of all schemes that your API supports
schemes:
- http
# will be prefixed to all paths
basePath: /
produces:
- application/json
paths:
/trainer/trainer/info:
post:
summary: 获取教练信息
description: 获取教练信息
parameters:
- name: ex_id
in: body #Possible values are "query", "header", "path", "formData" or "body".
description: 教练id
required: true
type: number
format: integer
- name: mobile
in: query
description: 教练手机号
required: true
type: number
format: double
tags:
- Products
responses:
200:
description: 返回dict
schema:
type: array
items:
$ref: '#/definitions/Product'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Product:
properties:
product_id:
type: string
description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.
description:
type: string
description: Description of product.
display_name:
type: string
description: Display name of product.
capacity:
type: string
description: Capacity of product. For example, 4 people.
image:
type: string
description: Image URL representing the product.
PriceEstimate:
properties:
product_id:
type: string
description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles
currency_code:
type: string
description: "[ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code."
display_name:
type: string
description: Display name of product.
estimate:
type: string
description: Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI.
low_estimate:
type: number
description: Lower bound of the estimated price.
high_estimate:
type: number
description: Upper bound of the estimated price.
surge_multiplier:
type: number
description: Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier.
Profile:
properties:
first_name:
type: string
description: First name of the Uber user.
last_name:
type: string
description: Last name of the Uber user.
email:
type: string
description: Email address of the Uber user
picture:
type: string
description: Image URL of the Uber user.
promo_code:
type: string
description: Promo code of the Uber user.
Activity:
properties:
uuid:
type: string
description: Unique identifier for the activity
Activities:
properties:
offset:
type: integer
format: int32
description: Position in pagination.
limit:
type: integer
format: int32
description: Number of items to retrieve (100 max).
count:
type: integer
format: int32
description: Total number of items available.
history:
type: array
items:
$ref: '#/definitions/Activity'
Error:
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