forked from freenet-public/got-swag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpetstore.yaml
88 lines (86 loc) · 1.93 KB
/
petstore.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Custom tests example
# got-swag examples/petstore.yaml examples/vars.yaml
# The tests could be published by the service itself
swagger: "2.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
host: petstore.swagger.io
basePath: /v2
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/pet/findByStatus:
get:
summary: Finds pets by status
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: false
type: array
items:
type: string
responses:
200:
description: An array of pets
schema:
$ref: '#/definitions/Pets'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
x-tests:
- description: Should find pets
steps:
- get( '/v2/pet/findByStatus?status=available' )
- log( res.json[ 0 ] )
- log( res.json[ 1 ] )
- equal( res.statusCode, 200 )
- ok( res.json.length > 0 )
- equal( typeof res.json[ 0 ].name, 'string' )
- validate()
- description: Should not find evil pets
steps:
- get( '/v2/pet/findByStatus?status=evil' )
- deepEqual( res.json, [] )
- validate()
definitions:
Pet:
required:
- name
properties:
id:
type: integer
category:
$ref: '#/definitions/Category'
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: '#/definitions/Pet'
Category:
properties:
id:
type: integer
name:
type: string
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string