-
Notifications
You must be signed in to change notification settings - Fork 0
/
contract.yaml
152 lines (150 loc) · 3.59 KB
/
contract.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
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
openapi: 3.0.1
info:
title: Convictional Interview API Contract
description: This is the required output for the Convictional Eng Challenge
contact:
email: [email protected]
version: 1.0.0
externalDocs:
description: Find out more about Convictional
url: https://convictional.com
tags:
- name: product
description: Representation of a seller's products
# API Paths
paths:
/product:
get:
tags:
- product
summary: Find product by ID
description: Returns a single product
operationId: getAllProducts
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/product'
400:
description: Invalid ID supplied
content: {}
404:
description: product not found
content: {}
/product/{productId}:
get:
tags:
- product
summary: Find product by ID
description: Returns a single product
operationId: getProductById
parameters:
- name: productId
in: path
description: ID of product to return
required: true
schema:
type: integer
format: int64
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/product'
400:
description: Invalid ID supplied
content: {}
404:
description: product not found
content: {}
/store/inventory:
get:
tags:
- store
summary: Returns product inventories
description: Returns an array of inventory objects for each variant
operationId: getInventory
responses:
200:
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/inventory'
# API Objects
components:
schemas:
inventory:
properties:
productId:
type: string
variantId:
type: string
stock:
type: integer
format: int64
product:
required:
- code
type: object
properties:
code:
type: string
title:
type: string
description: Product title
vendor:
type: string
description: Product vendor
bodyHtml:
type: string
description: HTML description of a product
variants:
type: array
items:
$ref: '#/components/schemas/variant'
images:
type: array
items:
$ref: '#/components/schemas/image'
variant:
properties:
id:
type: string
title:
type: string
sku:
type: string
available:
type: boolean
description: True if inventory > 0, false otherwise
inventory_quantity:
type: integer
format: int64
weight:
$ref: '#/components/schemas/weight'
weight:
type: object
properties:
value:
type: integer
format: int64
unit:
type: string
image:
required:
- source
- variantId
type: object
properties:
source:
type: string
variantId:
type: string
description: ID for the variant the image relates to