180 lines
5.7 KiB
JSON
180 lines
5.7 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "This is a sample server Petstore server.",
|
|
"title": "Swagger Example API",
|
|
"termsOfService": "http://swagger.io/terms/",
|
|
"contact": {
|
|
"name": "API Support",
|
|
"url": "http://www.swagger.io/support",
|
|
"email": "support@swagger.io"
|
|
},
|
|
"license": {
|
|
"name": "Apache 2.0",
|
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
},
|
|
"version": "1.0"
|
|
},
|
|
"host": "petstore.swagger.io:8080",
|
|
"basePath": "/v2",
|
|
"paths": {
|
|
"/v2/object": {
|
|
"get": {
|
|
"description": "blabla...",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "get an object",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Some ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "ok",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.Object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "We need ID!!",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Can not find ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "blabla...",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "create an object.",
|
|
"parameters": [
|
|
{
|
|
"description": "Add Object",
|
|
"name": "object",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/main.Object"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "ok",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.Object"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "We need ID!!",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Can not find ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v2/object/{id}": {
|
|
"get": {
|
|
"description": "get struct array by ID",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Offset",
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Offset",
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "ok",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "We need ID!!",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Can not find ID",
|
|
"schema": {
|
|
"$ref": "#/definitions/main.APIError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"main.APIError": {
|
|
"type": "object",
|
|
"properties": {
|
|
"createdAt": {
|
|
"type": "string"
|
|
},
|
|
"errorCode": {
|
|
"type": "integer"
|
|
},
|
|
"errorMessage": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"main.Object": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"description": "这是一个ID",
|
|
"type": "integer"
|
|
},
|
|
"name": {
|
|
"description": "这是对象的名字",
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |