121 lines
2.8 KiB
YAML
121 lines
2.8 KiB
YAML
basePath: /v2
|
|
definitions:
|
|
main.APIError:
|
|
properties:
|
|
createdAt:
|
|
type: string
|
|
errorCode:
|
|
type: integer
|
|
errorMessage:
|
|
type: string
|
|
type: object
|
|
main.Object:
|
|
properties:
|
|
id:
|
|
description: 这是一个ID
|
|
type: integer
|
|
name:
|
|
description: 这是对象的名字
|
|
type: string
|
|
type: object
|
|
host: petstore.swagger.io:8080
|
|
info:
|
|
contact:
|
|
email: support@swagger.io
|
|
name: API Support
|
|
url: http://www.swagger.io/support
|
|
description: This is a sample server Petstore server.
|
|
license:
|
|
name: Apache 2.0
|
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
termsOfService: http://swagger.io/terms/
|
|
title: Swagger Example API
|
|
version: "1.0"
|
|
paths:
|
|
/v2/object:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: blabla...
|
|
parameters:
|
|
- description: Some ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
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'
|
|
summary: get an object
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: blabla...
|
|
parameters:
|
|
- description: Add Object
|
|
in: body
|
|
name: object
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/main.Object'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
summary: create an object.
|
|
/v2/object/{id}:
|
|
get:
|
|
consumes:
|
|
- application/json
|
|
description: get struct array by ID
|
|
parameters:
|
|
- description: Offset
|
|
in: query
|
|
name: offset
|
|
required: true
|
|
type: integer
|
|
- description: Offset
|
|
in: query
|
|
name: limit
|
|
required: true
|
|
type: integer
|
|
produces:
|
|
- application/json
|
|
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'
|
|
swagger: "2.0"
|