Skip to content

Instantly share code, notes, and snippets.

@mxl
Created July 25, 2015 11:04
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 mxl/df3ad1b1a1b57502ec61 to your computer and use it in GitHub Desktop.
Save mxl/df3ad1b1a1b57502ec61 to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "API",
"description": "API"
},
"schemes": [
"http"
],
"paths": {
"/test1": {
"get": {
"description": "Test1",
"produces": [
"application/json"
],
"responses": {
"200": {
"$ref": "#/responses/default"
}
}
}
},
"/test2": {
"get": {
"description": "Test2",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "response",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response"
},
{
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}
]
}
}
}
}
}
},
"definitions": {
"response": {
"properties": {
"errorCode": {
"default": 0,
"type": "integer",
"enum": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12
],
"description": "Status code"
},
"success": {
"default": true,
"type": "boolean",
"description": "Success flag"
}
}
}
},
"responses": {
"default": {
"description": "response",
"schema": {
"$ref": "#/definitions/response"
}
}
}
}
swagger: '2.0'
info:
version: "1.0.0"
title: API
description: API
schemes:
- http
paths:
/test1:
get:
description: Test1
produces:
- application/json
responses:
'200':
$ref: '#/responses/default'
/test2:
get:
description: Test2
produces:
- application/json
responses:
'200':
description: response
schema:
allOf:
- $ref: '#/definitions/response'
- type: object
properties:
token:
type: string
definitions:
response:
properties:
errorCode:
default: 0
type: integer
enum: [0,1,2,3,4,5,6,7,8,9,10,11,12]
description: Status code
success:
default: true
type: boolean
description: Success flag
responses:
default:
description: response
schema:
$ref: '#/definitions/response'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment