-
Notifications
You must be signed in to change notification settings - Fork 154
/
api.yml
113 lines (110 loc) · 4.05 KB
/
api.yml
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
openapi: 3.0.3
info:
title: Receipt Processor
description: A simple receipt processor
version: 1.0.0
paths:
/receipts/process:
post:
summary: Submits a receipt for processing
description: Submits a receipt for processing
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Receipt"
responses:
200:
description: Returns the ID assigned to the receipt
content:
application/json:
schema:
type: object
required:
- id
properties:
id:
type: string
pattern: "^\\S+$"
example: adb6b560-0eef-42bc-9d16-df48f30e89b2
400:
description: The receipt is invalid
/receipts/{id}/points:
get:
summary: Returns the points awarded for the receipt
description: Returns the points awarded for the receipt
parameters:
- name: id
in: path
required: true
description: The ID of the receipt
schema:
type: string
pattern: "^\\S+$"
responses:
200:
description: The number of points awarded
content:
application/json:
schema:
type: object
properties:
points:
type: integer
format: int64
example: 100
404:
description: No receipt found for that id
components:
schemas:
Receipt:
type: object
required:
- retailer
- purchaseDate
- purchaseTime
- items
- total
properties:
retailer:
description: The name of the retailer or store the receipt is from.
type: string
pattern: "^[\\w\\s\\-&]+$"
example: "M&M Corner Market"
purchaseDate:
description: The date of the purchase printed on the receipt.
type: string
format: date
example: "2022-01-01"
purchaseTime:
description: The time of the purchase printed on the receipt. 24-hour time expected.
type: string
format: time
example: "13:01"
items:
type: array
minItems: 1
items:
$ref: "#/components/schemas/Item"
total:
description: The total amount paid on the receipt.
type: string
pattern: "^\\d+\\.\\d{2}$"
example: "6.49"
Item:
type: object
required:
- shortDescription
- price
properties:
shortDescription:
description: The Short Product Description for the item.
type: string
pattern: "^[\\w\\s\\-]+$"
example: "Mountain Dew 12PK"
price:
description: The total price payed for this item.
type: string
pattern: "^\\d+\\.\\d{2}$"
example: "6.49"