-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoas3.yaml
116 lines (114 loc) · 2.79 KB
/
oas3.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
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
openapi: 3.0.0
info:
version: '1.0'
title: "EasyLib OpenAPI 3.0"
description: API for managing book lendings.
license:
name: MIT
servers:
- url: http://localhost:8000/api/v1
description: Localhost
paths:
/students:
post:
description: >-
Creates a new student in the system.
summary: Register a new student
requestBody:
content:
application/json:
schema:
type: object
required:
- email
properties:
email:
type: string
description: 'Email address of the student'
responses:
'201':
description: 'User created. Link in the Location header'
headers:
'Location':
schema:
type: string
description: Link to the newly created student.
/books:
get:
description: >-
Gets the list of books.
summary: View all books
responses:
'200':
description: 'Collection of books'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Book'
/booklendings:
post:
description: >-
Creates a new booklending.
summary: Borrow a book
responses:
'201':
description: 'Booklending created. Link in the Location header'
headers:
'Location':
schema:
type: string
description: Link to the newly created booklending.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Booklending'
components:
schemas:
Student:
type: object
required:
- id
- email
properties:
id:
type: integer
description: 'ID of the user'
email:
type: string
description: 'Email address of the user'
Book:
type: object
required:
- title
- author
- ISBN
- status
properties:
title:
type: string
description: 'Title of the book'
author:
type: string
description: 'Author of the book'
ISBN:
type: string
description: 'ISBN of the book'
status:
type: string
enum: [available, lended]
description: 'Tells whether the book is currently available or not'
Booklending:
type: object
required:
- student
- book
properties:
user:
type: string
description: 'Link to the user'
book:
type: integer
description: 'Link to the book'