-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
162 lines (152 loc) · 3.21 KB
/
swagger.yaml
File metadata and controls
162 lines (152 loc) · 3.21 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
swagger: "2.0"
info:
title: Books API
description: basic CRUD API
version: "1"
basePath: /
parameters:
isbn:
name: isbn
in: path
description: Name of the book
required: true
type: string
authorName:
name: authorName
in: query
description: Name of the author
type: string
required: false
rating:
name: rating
in: query
description: Book rating
type: number
required: false
responses:
BadRequest:
description: Bad Request
schema:
$ref: "#/definitions/Problem"
Created:
description: Created
NoContent:
description: No Content
NotFound:
description: Not Found
schema:
$ref: "#/definitions/Problem"
paths:
/books:
get:
summary: Get all books
operationId: list_books
parameters:
- $ref: "#/parameters/authorName"
- $ref: "#/parameters/rating"
responses:
200:
description: List of books
500:
description: Unexpected error
post:
summary: Create a book
operationId: post_book
parameters:
- name: bookRequest
in: body
description: event payload
required: true
schema:
$ref: "#/definitions/postBookRequest"
responses:
200:
description: response data
400:
$ref: "#/responses/BadRequest"
500:
description: Unexpected error
/books/{isbn}:
get:
summary: Get all books
operationId: get_book
parameters:
- $ref: "#/parameters/isbn"
responses:
200:
description: book
404:
$ref: "#/responses/NotFound"
500:
description: Unexpected error
put:
summary: Update a book
operationId: put_book
parameters:
- $ref: "#/parameters/isbn"
- name: bookRequest
in: body
description: event payload
required: true
schema:
$ref: "#/definitions/putBookRequest"
responses:
200:
description: response data
404:
$ref: "#/responses/NotFound"
500:
description: Unexpected error
delete:
summary: Update a book
operationId: delete_book
parameters:
- $ref: "#/parameters/isbn"
responses:
204:
description: deleted
404:
$ref: "#/responses/NotFound"
500:
description: Unexpected error
definitions:
Problem:
type: object
properties:
error:
type: string
status:
type: number
required: ["error", "status"]
postBookRequest:
additionalProperties: False
type: object
properties:
isbn:
type: string
bookName:
type: string
authorName:
type: string
rating:
type: number
minimum: 1
maximum: 5
enum: [1, 2, 3, 4, 5]
required:
- isbn
- bookName
- authorName
- rating
putBookRequest:
additionalProperties: False
type: object
properties:
bookName:
type: string
authorName:
type: string
rating:
type: number
minimum: 1
maximum: 5