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>
This commit is contained in:
Arnaud 2025-04-02 16:09:23 +02:00 committed by GitHub
parent 1213377ac4
commit 4e2a321ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,10 +27,6 @@ components:
maxLength: 66 maxLength: 66
example: 0x... example: 0x...
BigInt:
type: string
description: Integer represented as decimal string
Cid: Cid:
type: string type: string
description: Content Identifier as specified at https://github.com/multiformats/cid description: Content Identifier as specified at https://github.com/multiformats/cid
@ -55,17 +51,18 @@ components:
description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay description: The amount of tokens paid per byte per second per slot to hosts the client is willing to pay
Duration: Duration:
type: string type: integer
description: The duration of the request in seconds as decimal string format: int64
description: The duration of the request in seconds
ProofProbability: ProofProbability:
type: string type: string
description: How often storage proofs are required as decimal string description: How often storage proofs are required as decimal string
Expiry: Expiry:
type: string type: integer
format: int64
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. 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.
default: 10 minutes
SPR: SPR:
type: string type: string
@ -73,6 +70,8 @@ components:
SPRRead: SPRRead:
type: object type: object
required:
- spr
properties: properties:
spr: spr:
$ref: "#/components/schemas/SPR" $ref: "#/components/schemas/SPR"
@ -85,6 +84,8 @@ components:
Content: Content:
type: object type: object
required:
- cid
description: Parameters specifying the content description: Parameters specifying the content
properties: properties:
cid: cid:
@ -92,6 +93,12 @@ components:
Node: Node:
type: object type: object
required:
- nodeId
- peerId
- record
- address
- seen
properties: properties:
nodeId: nodeId:
type: string type: string
@ -116,6 +123,9 @@ components:
PeersTable: PeersTable:
type: object type: object
required:
- localNode
- nodes
properties: properties:
localNode: localNode:
$ref: "#/components/schemas/Node" $ref: "#/components/schemas/Node"
@ -126,6 +136,14 @@ components:
DebugInfo: DebugInfo:
type: object type: object
required:
- id
- addrs
- repo
- spr
- announceAddresses
- table
- codex
properties: properties:
id: id:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
@ -149,12 +167,16 @@ components:
SalesAvailability: SalesAvailability:
type: object type: object
required:
- totalSize
- duration
- minPricePerBytePerSecond
- totalCollateral
properties: properties:
id:
$ref: "#/components/schemas/Id"
totalSize: totalSize:
type: string type: integer
description: Total size of availability's storage in bytes as decimal string format: int64
description: Total size of availability's storage in bytes
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
minPricePerBytePerSecond: minPricePerBytePerSecond:
@ -173,42 +195,53 @@ components:
default: 0 default: 0
SalesAvailabilityREAD: SalesAvailabilityREAD:
required:
- id
- totalRemainingCollateral
allOf: allOf:
- $ref: "#/components/schemas/SalesAvailability" - $ref: "#/components/schemas/SalesAvailability"
- type: object - type: object
properties: properties:
id:
$ref: "#/components/schemas/Id"
readonly: true
freeSize: freeSize:
type: string type: integer
format: int64
description: Unused size of availability's storage in bytes as decimal string description: Unused size of availability's storage in bytes as decimal string
readOnly: true
SalesAvailabilityCREATE: totalRemainingCollateral:
allOf: type: string
- $ref: "#/components/schemas/SalesAvailability" description: Total collateral effective (in amount of tokens) that can be used for matching requests
- required: readOnly: true
- totalSize
- minPricePerBytePerSecond
- totalCollateral
- duration
Slot: Slot:
type: object type: object
required:
- id
- request
- slotIndex
properties: properties:
id: id:
$ref: "#/components/schemas/SlotId" $ref: "#/components/schemas/SlotId"
request: request:
$ref: "#/components/schemas/StorageRequest" $ref: "#/components/schemas/StorageRequest"
slotIndex: slotIndex:
type: string type: integer
description: Slot Index as decimal string format: int64
description: Slot Index number
SlotAgent: SlotAgent:
type: object type: object
required:
- state
- requestId
- slotIndex
properties: properties:
id:
$ref: "#/components/schemas/SlotId"
slotIndex: slotIndex:
type: string type: integer
description: Slot Index as decimal string format: int64
description: Slot Index number
requestId: requestId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
request: request:
@ -235,18 +268,28 @@ components:
Reservation: Reservation:
type: object type: object
required:
- id
- availabilityId
- size
- requestId
- slotIndex
- validUntil
properties: properties:
id: id:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
availabilityId: availabilityId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
size: size:
$ref: "#/components/schemas/BigInt" type: integer
format: int64
description: Size of the slot in bytes
requestId: requestId:
$ref: "#/components/schemas/Id" $ref: "#/components/schemas/Id"
slotIndex: slotIndex:
type: string type: integer
description: Slot Index as decimal string format: int64
description: Slot Index number
validUntil: validUntil:
type: integer type: integer
description: Timestamp after which the reservation will no longer be valid. description: Timestamp after which the reservation will no longer be valid.
@ -269,28 +312,39 @@ components:
nodes: nodes:
description: Minimal number of nodes the content should be stored on description: Minimal number of nodes the content should be stored on
type: integer type: integer
default: 1 default: 3
minimum: 3
tolerance: tolerance:
description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost description: Additional number of nodes on top of the `nodes` property that can be lost before pronouncing the content lost
type: integer type: integer
default: 0 default: 1
minimum: 1
collateralPerByte: collateralPerByte:
type: string type: string
description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots description: Number as decimal string that represents how much collateral per byte is asked from hosts that wants to fill a slots
expiry: expiry:
type: string type: integer
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. format: int64
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.
StorageAsk: StorageAsk:
type: object type: object
required: required:
- slots
- slotSize
- duration
- proofProbability
- pricePerBytePerSecond - pricePerBytePerSecond
- collateralPerByte
- maxSlotLoss
properties: properties:
slots: slots:
description: Number of slots (eq. hosts) that the Request want to have the content spread over description: Number of slots (eq. hosts) that the Request want to have the content spread over
type: integer type: integer
format: int64
slotSize: slotSize:
type: string type: integer
description: Amount of storage per slot (in bytes) as decimal string format: int64
description: Amount of storage per slot in bytes
duration: duration:
$ref: "#/components/schemas/Duration" $ref: "#/components/schemas/Duration"
proofProbability: proofProbability:
@ -299,10 +353,18 @@ components:
$ref: "#/components/schemas/PricePerBytePerSecond" $ref: "#/components/schemas/PricePerBytePerSecond"
maxSlotLoss: maxSlotLoss:
type: integer type: integer
format: int64
description: Max slots that can be lost without data considered to be lost description: Max slots that can be lost without data considered to be lost
StorageRequest: StorageRequest:
type: object type: object
required:
- id
- client
- ask
- content
- expiry
- nonce
properties: properties:
id: id:
type: string type: string
@ -321,6 +383,9 @@ components:
Purchase: Purchase:
type: object type: object
required:
- state
- requestId
properties: properties:
state: state:
type: string type: string
@ -340,9 +405,13 @@ components:
description: If Request failed, then here is presented the error message description: If Request failed, then here is presented the error message
request: request:
$ref: "#/components/schemas/StorageRequest" $ref: "#/components/schemas/StorageRequest"
requestId:
$ref: "#/components/schemas/Id"
DataList: DataList:
type: object type: object
required:
- content
properties: properties:
content: content:
type: array type: array
@ -351,6 +420,9 @@ components:
DataItem: DataItem:
type: object type: object
required:
- cid
- manifest
properties: properties:
cid: cid:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
@ -359,6 +431,11 @@ components:
ManifestItem: ManifestItem:
type: object type: object
required:
- treeCid
- datasetSize
- blockSize
- protected
properties: properties:
treeCid: treeCid:
$ref: "#/components/schemas/Cid" $ref: "#/components/schemas/Cid"
@ -386,6 +463,11 @@ components:
Space: Space:
type: object type: object
required:
- totalBlocks
- quotaMaxBytes
- quotaUsedBytes
- quotaReservedBytes
properties: properties:
totalBlocks: totalBlocks:
description: "Number of blocks stored by the node" description: "Number of blocks stored by the node"
@ -704,7 +786,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/SalesAvailabilityCREATE" $ref: "#/components/schemas/SalesAvailability"
responses: responses:
"201": "201":
description: Created storage availability description: Created storage availability
@ -870,7 +952,7 @@ paths:
"200": "200":
description: Node's SPR description: Node's SPR
content: content:
plain/text: text/plain:
schema: schema:
$ref: "#/components/schemas/SPR" $ref: "#/components/schemas/SPR"
application/json: application/json:
@ -888,7 +970,7 @@ paths:
"200": "200":
description: Node's Peer ID description: Node's Peer ID
content: content:
plain/text: text/plain:
schema: schema:
$ref: "#/components/schemas/PeerId" $ref: "#/components/schemas/PeerId"
application/json: application/json: