Skip to content

Commit 4e2a321

Browse files
2-townsAuHau
andauthored
chore(openapi): add required parameters (#1178)
* Update the openapi file * Fix typo * Remove SalesAvailabilityCREATE and add collateralPerByte * Fix SalesAvailability reference * chore: adding perf optimization tweaks to openapi (#1182) * chore: adding perf optimization tweaks to openapi * chore: slotsize integer --------- Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
1 parent 1213377 commit 4e2a321

File tree

1 file changed

+122
-40
lines changed

1 file changed

+122
-40
lines changed

openapi.yaml

Lines changed: 122 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ components:
2727
maxLength: 66
2828
example: 0x...
2929

30-
BigInt:
31-
type: string
32-
description: Integer represented as decimal string
33-
3430
Cid:
3531
type: string
3632
description: Content Identifier as specified at https://github.com/multiformats/cid
@@ -55,24 +51,27 @@ components:
5551
description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay
5652

5753
Duration:
58-
type: string
59-
description: The duration of the request in seconds as decimal string
54+
type: integer
55+
format: int64
56+
description: The duration of the request in seconds
6057

6158
ProofProbability:
6259
type: string
6360
description: How often storage proofs are required as decimal string
6461

6562
Expiry:
66-
type: string
63+
type: integer
64+
format: int64
6765
description: A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
68-
default: 10 minutes
6966

7067
SPR:
7168
type: string
7269
description: Signed Peer Record (libp2p)
7370

7471
SPRRead:
7572
type: object
73+
required:
74+
- spr
7675
properties:
7776
spr:
7877
$ref: "#/components/schemas/SPR"
@@ -85,13 +84,21 @@ components:
8584

8685
Content:
8786
type: object
87+
required:
88+
- cid
8889
description: Parameters specifying the content
8990
properties:
9091
cid:
9192
$ref: "#/components/schemas/Cid"
9293

9394
Node:
9495
type: object
96+
required:
97+
- nodeId
98+
- peerId
99+
- record
100+
- address
101+
- seen
95102
properties:
96103
nodeId:
97104
type: string
@@ -116,6 +123,9 @@ components:
116123

117124
PeersTable:
118125
type: object
126+
required:
127+
- localNode
128+
- nodes
119129
properties:
120130
localNode:
121131
$ref: "#/components/schemas/Node"
@@ -126,6 +136,14 @@ components:
126136

127137
DebugInfo:
128138
type: object
139+
required:
140+
- id
141+
- addrs
142+
- repo
143+
- spr
144+
- announceAddresses
145+
- table
146+
- codex
129147
properties:
130148
id:
131149
$ref: "#/components/schemas/PeerId"
@@ -149,12 +167,16 @@ components:
149167

150168
SalesAvailability:
151169
type: object
170+
required:
171+
- totalSize
172+
- duration
173+
- minPricePerBytePerSecond
174+
- totalCollateral
152175
properties:
153-
id:
154-
$ref: "#/components/schemas/Id"
155176
totalSize:
156-
type: string
157-
description: Total size of availability's storage in bytes as decimal string
177+
type: integer
178+
format: int64
179+
description: Total size of availability's storage in bytes
158180
duration:
159181
$ref: "#/components/schemas/Duration"
160182
minPricePerBytePerSecond:
@@ -173,42 +195,53 @@ components:
173195
default: 0
174196

175197
SalesAvailabilityREAD:
198+
required:
199+
- id
200+
- totalRemainingCollateral
176201
allOf:
177202
- $ref: "#/components/schemas/SalesAvailability"
178203
- type: object
179204
properties:
205+
id:
206+
$ref: "#/components/schemas/Id"
207+
readonly: true
180208
freeSize:
181-
type: string
209+
type: integer
210+
format: int64
182211
description: Unused size of availability's storage in bytes as decimal string
183-
184-
SalesAvailabilityCREATE:
185-
allOf:
186-
- $ref: "#/components/schemas/SalesAvailability"
187-
- required:
188-
- totalSize
189-
- minPricePerBytePerSecond
190-
- totalCollateral
191-
- duration
212+
readOnly: true
213+
totalRemainingCollateral:
214+
type: string
215+
description: Total collateral effective (in amount of tokens) that can be used for matching requests
216+
readOnly: true
192217

193218
Slot:
194219
type: object
220+
required:
221+
- id
222+
- request
223+
- slotIndex
195224
properties:
196225
id:
197226
$ref: "#/components/schemas/SlotId"
198227
request:
199228
$ref: "#/components/schemas/StorageRequest"
200229
slotIndex:
201-
type: string
202-
description: Slot Index as decimal string
230+
type: integer
231+
format: int64
232+
description: Slot Index number
203233

204234
SlotAgent:
205235
type: object
236+
required:
237+
- state
238+
- requestId
239+
- slotIndex
206240
properties:
207-
id:
208-
$ref: "#/components/schemas/SlotId"
209241
slotIndex:
210-
type: string
211-
description: Slot Index as decimal string
242+
type: integer
243+
format: int64
244+
description: Slot Index number
212245
requestId:
213246
$ref: "#/components/schemas/Id"
214247
request:
@@ -235,18 +268,28 @@ components:
235268

236269
Reservation:
237270
type: object
271+
required:
272+
- id
273+
- availabilityId
274+
- size
275+
- requestId
276+
- slotIndex
277+
- validUntil
238278
properties:
239279
id:
240280
$ref: "#/components/schemas/Id"
241281
availabilityId:
242282
$ref: "#/components/schemas/Id"
243283
size:
244-
$ref: "#/components/schemas/BigInt"
284+
type: integer
285+
format: int64
286+
description: Size of the slot in bytes
245287
requestId:
246288
$ref: "#/components/schemas/Id"
247289
slotIndex:
248-
type: string
249-
description: Slot Index as decimal string
290+
type: integer
291+
format: int64
292+
description: Slot Index number
250293
validUntil:
251294
type: integer
252295
description: Timestamp after which the reservation will no longer be valid.
@@ -269,28 +312,39 @@ components:
269312
nodes:
270313
description: Minimal number of nodes the content should be stored on
271314
type: integer
272-
default: 1
315+
default: 3
316+
minimum: 3
273317
tolerance:
274318
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
275319
type: integer
276-
default: 0
320+
default: 1
321+
minimum: 1
277322
collateralPerByte:
278323
type: string
279324
description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots
280325
expiry:
281-
type: string
282-
description: Number as decimal string that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.
326+
type: integer
327+
format: int64
328+
description: Number that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.
283329
StorageAsk:
284330
type: object
285331
required:
332+
- slots
333+
- slotSize
334+
- duration
335+
- proofProbability
286336
- pricePerBytePerSecond
337+
- collateralPerByte
338+
- maxSlotLoss
287339
properties:
288340
slots:
289341
description: Number of slots (eq. hosts) that the Request want to have the content spread over
290342
type: integer
343+
format: int64
291344
slotSize:
292-
type: string
293-
description: Amount of storage per slot (in bytes) as decimal string
345+
type: integer
346+
format: int64
347+
description: Amount of storage per slot in bytes
294348
duration:
295349
$ref: "#/components/schemas/Duration"
296350
proofProbability:
@@ -299,10 +353,18 @@ components:
299353
$ref: "#/components/schemas/PricePerBytePerSecond"
300354
maxSlotLoss:
301355
type: integer
356+
format: int64
302357
description: Max slots that can be lost without data considered to be lost
303358

304359
StorageRequest:
305360
type: object
361+
required:
362+
- id
363+
- client
364+
- ask
365+
- content
366+
- expiry
367+
- nonce
306368
properties:
307369
id:
308370
type: string
@@ -321,6 +383,9 @@ components:
321383

322384
Purchase:
323385
type: object
386+
required:
387+
- state
388+
- requestId
324389
properties:
325390
state:
326391
type: string
@@ -340,9 +405,13 @@ components:
340405
description: If Request failed, then here is presented the error message
341406
request:
342407
$ref: "#/components/schemas/StorageRequest"
408+
requestId:
409+
$ref: "#/components/schemas/Id"
343410

344411
DataList:
345412
type: object
413+
required:
414+
- content
346415
properties:
347416
content:
348417
type: array
@@ -351,6 +420,9 @@ components:
351420

352421
DataItem:
353422
type: object
423+
required:
424+
- cid
425+
- manifest
354426
properties:
355427
cid:
356428
$ref: "#/components/schemas/Cid"
@@ -359,6 +431,11 @@ components:
359431

360432
ManifestItem:
361433
type: object
434+
required:
435+
- treeCid
436+
- datasetSize
437+
- blockSize
438+
- protected
362439
properties:
363440
treeCid:
364441
$ref: "#/components/schemas/Cid"
@@ -386,6 +463,11 @@ components:
386463

387464
Space:
388465
type: object
466+
required:
467+
- totalBlocks
468+
- quotaMaxBytes
469+
- quotaUsedBytes
470+
- quotaReservedBytes
389471
properties:
390472
totalBlocks:
391473
description: "Number of blocks stored by the node"
@@ -704,7 +786,7 @@ paths:
704786
content:
705787
application/json:
706788
schema:
707-
$ref: "#/components/schemas/SalesAvailabilityCREATE"
789+
$ref: "#/components/schemas/SalesAvailability"
708790
responses:
709791
"201":
710792
description: Created storage availability
@@ -870,7 +952,7 @@ paths:
870952
"200":
871953
description: Node's SPR
872954
content:
873-
plain/text:
955+
text/plain:
874956
schema:
875957
$ref: "#/components/schemas/SPR"
876958
application/json:
@@ -888,7 +970,7 @@ paths:
888970
"200":
889971
description: Node's Peer ID
890972
content:
891-
plain/text:
973+
text/plain:
892974
schema:
893975
$ref: "#/components/schemas/PeerId"
894976
application/json:

0 commit comments

Comments
 (0)