docmoc
Version:
Documentation and Mock Server for Swagger
147 lines (146 loc) • 2.96 kB
YAML
swagger: "2.0"
info:
description: APIs for testing
title: Test APIs
version: 1.0.0
consumes:
- application/json
produces:
- application/json
schemes:
- http
- https
basePath: /v2
definitions:
role:
type: string
enum:
- admin
- staff
- visitor
user:
type: object
required:
- name
properties:
id:
type: integer
format: int64
readOnly: true
minimum: 1
maximum: 99999
name:
type: string
age:
type: integer
format: int32
minimum: 18
maximum: 99
createdAt:
allOf:
- $ref: "#/definitions/role"
- type: string
enum:
- foo
- bar
- baz
paths:
/users:
get:
summary: Find users
tags:
- users
operationId: findUsers
parameters:
- name: keyword
in: query
type: string
- name: sort
in: query
type: string
enum: ["+id", "-id"]
- name: perpage
in: query
type: integer
format: int32
responses:
200:
description: OK
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/definitions/user"
x-mock-array-size: 15
total:
type: integer
format: int64
minimum: 0
x-mock-array-key: data
x-vuex-key:
data: users
total: usersTotalCount
post:
summary: Add a user
tags:
- users
operationId: addUser
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/user"
responses:
201:
description: Created
schema:
$ref: "#/definitions/user"
/user/{id}:
parameters:
- type: integer
format: int64
name: id
in: path
required: true
get:
summary: Get a user by user ID
tags:
- user
operationId: getUser
responses:
200:
description: OK
schema:
type: object
properties:
data:
$ref: "#/definitions/user"
x-vuex-key:
data: user
put:
summary: Update a user by user ID
tags:
- user
operationId: updateUser
parameters:
- name: body
in: body
schema:
$ref: "#/definitions/user"
responses:
200:
description: OK
schema:
$ref: "#/definitions/user"
x-vuex-key:
data: user
delete:
summary: Delete a user by user ID
tags:
- user
operationId: deleteUser
responses:
204:
description: Deleted