YouChuKoffee/docs/swagger.json

318 lines
10 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"swagger": "2.0",
"info": {
"description": "This is a sample server celler 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": "localhost:8080",
"basePath": "/",
"paths": {
"/test": {
"post": {
"description": "request和response的示例",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"snow"
],
"summary": "request和response的示例",
"parameters": [
{
"description": "test request",
"name": "test",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.TestRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entities.TestResponse"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
}
}
}
},
"/test_validator": {
"post": {
"description": "HandleTestValidator的示例",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"snow"
],
"summary": "HandleTestValidator的示例",
"parameters": [
{
"description": "example of validator",
"name": "testValidator",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.TestValidatorRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entities.TestValidatorRequest"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/controllers.HTTPError"
}
}
}
}
}
},
"definitions": {
"controllers.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
},
"entities.Address": {
"type": "object",
"required": [
"city",
"phone",
"planet",
"street"
],
"properties": {
"city": {
"type": "string",
"example": "xiamen"
},
"phone": {
"type": "string",
"example": "snow"
},
"planet": {
"type": "string",
"example": "snow"
},
"street": {
"type": "string",
"example": "huandaodonglu"
}
}
},
"entities.TestRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "snow"
},
"url": {
"type": "string",
"example": "github.com/qit-team/snow"
}
}
},
"entities.TestResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "snow"
},
"url": {
"type": "string",
"example": "github.com/qit-team/snow"
}
}
},
"entities.TestValidatorRequest": {
"type": "object",
"required": [
"addresses",
"age",
"email",
"id",
"mobile",
"name",
"test_num",
"url"
],
"properties": {
"addresses": {
"type": "array",
"items": {
"$ref": "#/definitions/entities.Address"
}
},
"age": {
"type": "integer",
"maximum": 130,
"minimum": 0,
"example": 20
},
"content": {
"type": "string",
"example": "snow"
},
"email": {
"type": "string",
"example": "snow@github.com"
},
"id": {
"description": "tips因为组件required不管是没传值或者传 0 or \"\" 都通过不了但是如果用指针类型那么0就是0而nil无法通过校验",
"type": "integer",
"example": 1
},
"mobile": {
"type": "string",
"example": "snow"
},
"name": {
"type": "string",
"example": "snow"
},
"range_num": {
"type": "integer",
"maximum": 10,
"minimum": 1,
"example": 3
},
"test_num": {
"type": "integer",
"enum": [
5,
7,
9
],
"example": 7
},
"url": {
"type": "string",
"example": "github.com/qit-team/snow"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
},
"BasicAuth": {
"type": "basic"
},
"OAuth2AccessCode": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": "Grants read and write access to administrative information"
}
},
"OAuth2Application": {
"type": "oauth2",
"flow": "application",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": "Grants read and write access to administrative information",
"write": "Grants write access"
}
},
"OAuth2Implicit": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://example.com/oauth/authorize",
"scopes": {
"admin": "Grants read and write access to administrative information",
"write": "Grants write access"
}
},
"OAuth2Password": {
"type": "oauth2",
"flow": "password",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"admin": "Grants read and write access to administrative information",
"read": "Grants read access",
"write": "Grants write access"
}
}
}
}