-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathopenapi.yaml
121 lines (118 loc) · 2.79 KB
/
openapi.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
117
118
119
120
121
openapi: 3.1.0
info:
title: finmid Backend Challenge
summary: "Banking API"
version: 1.0.0
servers:
- url: http://localhost:8080/
description: Local server
tags:
- name: Accounts API
- name: Transactions API
paths:
/v1/accounts:
post:
tags:
- Accounts API
summary: Create account
description: Create a new account with optional balance
operationId: createAccount
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
required: true
responses:
201:
description: Account created
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
/v1/accounts/{accountId}:
get:
tags:
- Accounts API
summary: Get account
description: Get account by id
operationId: getAccount
parameters:
- name: accountId
in: path
required: true
schema:
$ref: "#/components/schemas/AccountId"
responses:
200:
description: Account details
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
/v1/transactions:
post:
tags:
- Transactions API
description: Perform a transaction between two accounts
operationId: createTransaction
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Transaction'
required: true
responses:
201:
description: Created transaction
content:
application/json:
schema:
$ref: '#/components/schemas/Transaction'
components:
schemas:
AccountId:
type: string
minLength: 1
maxLength: 36
examples:
- account-1
TransactionId:
type: string
minLength: 1
maxLength: 36
examples:
- transaction-1
Account:
type: object
required:
- id
properties:
id:
$ref: "#/components/schemas/AccountId"
balance:
type: number
format: double
examples:
- 123.45
Transaction:
type: object
required:
- id
- fromAccountId
- toAccountId
- amount
properties:
id:
$ref: "#/components/schemas/TransactionId"
fromAccountId:
description: Source account id
$ref: "#/components/schemas/AccountId"
toAccountId:
description: Destination account id
$ref: "#/components/schemas/AccountId"
amount:
type: number
format: double
examples:
- 123.45