Skip to content

Instantly share code, notes, and snippets.

@friso
Created February 20, 2017 13:43
Show Gist options
  • Save friso/169565d1308142137ce64c3aa061f15a to your computer and use it in GitHub Desktop.
Save friso/169565d1308142137ce64c3aa061f15a to your computer and use it in GitHub Desktop.
Swagger json
{
"swagger": "2.0",
"info": {
"description": "Dress service to impress.",
"version": "1.0-beta",
"title": "FashionTrade.com Dress API"
},
"basePath": "/",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/dresses": {
"get": {
"description": "Get all dresses available in the system.",
"operationId": "get_dresses",
"parameters": [
{
"name": "pageSize",
"in": "query",
"description": "Number of dresses to return in one page.",
"required": true,
"type": "integer",
"maximum": 200,
"minimum": 1
},
{
"name": "pageNum",
"in": "query",
"description": "Page number to return, starting at 0.",
"required": true,
"type": "integer",
"minimum": 0
},
{
"name": "sortOn",
"in": "query",
"description": "Attribute to sort the results on. One of price, average_rating.",
"required": false,
"type": "string",
"enum": [
"price",
"average_rating"
]
},
{
"name": "sortOrder",
"in": "query",
"description": "When sort_on is provided, use ascending or descending order.",
"required": false,
"type": "string",
"enum": [
"ascending",
"descending"
]
}
],
"responses": {
"200": {
"description": "List of dresses.",
"schema": {
"$ref": "#/definitions/DressList"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "Page not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/dresses/{dressId}": {
"get": {
"description": "Get a specific dress.",
"operationId": "get_dress",
"parameters": [
{
"name": "dressId",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Dress.",
"schema": {
"$ref": "#/definitions/DressDetail"
}
},
"404": {
"description": "Not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/trending": {
"get": {
"description": "Get the list of currently trending dresses based on ratings as they happen.",
"operationId": "get_trending",
"parameters": [
{
"name": "count",
"description": "The number of trending dresses to return.",
"in": "query",
"required": true,
"type": "integer",
"minimum": 1,
"maximum": 50
}
],
"responses": {
"200": {
"description": "List of the top-N trending dresses.",
"schema": {
"$ref": "#/definitions/DressDetail"
}
}
}
}
}
},
"definitions": {
"DressList": {
"type": "object",
"required": [
"items",
"total_pages"
],
"properties": {
"total_pages": {
"type": "integer"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/DressItem"
}
}
}
},
"DressItem": {
"type": "object",
"required": [
"brand_name",
"id",
"name",
"price",
"thumbnails",
"average_rating"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand_name": {
"type": "string"
},
"price": {
"type": "number"
},
"thumbnails": {
"type": "array",
"items": {
"type": "string"
}
},
"average_rating": {
"type": "number",
"minimum": 1,
"maximum": 5
}
}
},
"DressDetail": {
"type": "object",
"required": [
"brand",
"color",
"id",
"images",
"name",
"price",
"season",
"average_rating"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"brand": {
"$ref": "#/definitions/Brand"
},
"color": {
"type": "string"
},
"price": {
"type": "number"
},
"season": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "string"
}
},
"average_rating": {
"type": "number",
"minimum": 1,
"maximum": 5
}
}
},
"Brand": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"logo_url": {
"type": "string"
}
}
},
"ErrorResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment