Skip to content

Commit

Permalink
Merge pull request #571 from ethersphere/open-api-2-0
Browse files Browse the repository at this point in the history
updated openapi docs
  • Loading branch information
NoahMaizels authored Mar 22, 2024
2 parents f9ecf72 + 91edc57 commit 8dbd767
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 5 deletions.
104 changes: 103 additions & 1 deletion openapi/Swarm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,26 @@ paths:
$ref: "SwarmCommon.yaml#/components/responses/400"
default:
description: Default response
head:
summary: Requests the headers containing the content type and length for the reference
tags:
- Bytes
parameters:
- in: path
name: address
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
required: true
description: Swarm address of chunk
responses:
"200":
description: Chunk exists
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"404":
$ref: "SwarmCommon.yaml#/components/responses/404"
default:
description: Default response

"/chunks":
post:
Expand Down Expand Up @@ -332,6 +352,26 @@ paths:
$ref: "SwarmCommon.yaml#/components/responses/500"
default:
description: Default response
head:
summary: Get the headers containing the content type and length for the reference
tags:
- BZZ
parameters:
- in: path
name: address
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
required: true
description: Swarm address of chunk
responses:
"200":
description: Chunk exists
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"404":
$ref: "SwarmCommon.yaml#/components/responses/404"
default:
description: Default response

"/bzz/{reference}/{path}":
get:
Expand Down Expand Up @@ -598,6 +638,30 @@ paths:
default:
description: Default response

"/pins/check":
get:
summary: Validate pinned chunks integerity
tags:
- Pinning
parameters:
- in: query
name: ref
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmOnlyReference"
required: false
description: The number of items to skip before starting to collect the result set.
responses:
"200":
description: List of checked root hash references
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/PinCheckResponse"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"
default:
description: Default response

"/pss/send/{topic}/{targets}":
post:
summary: Send to recipient or target with Postal Service for Swarm
Expand Down Expand Up @@ -1913,6 +1977,44 @@ paths:
default:
description: Default response

"/rchash/{depth}/{anchor1}/{anchor2}":
get:
summary: Get reserve commitment hash with sample proofs
tags:
- RChash
parameters:
- in: path
name: depth
schema:
type: integer
minimum: 0
default: 0
required: true
description: The storage depth.
- in: path
name: anchor1
schema:
$ref: "#/components/schemas/HexString"
required: true
description: The first anchor.
- in: path
name: anchor2
schema:
$ref: "#/components/schemas/HexString"
required: true
description: The second anchor.
responses:
"200":
description: Reserve sample response
content:
application/json:
schema:
$ref: "SwarmCommon.yaml#/components/schemas/ApiRCHashResponse"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"
default:
description: Default response

components:
securitySchemes:
basicAuth:
Expand All @@ -1922,4 +2024,4 @@ components:
bearerAuth:
type: http
scheme: bearer
bearerFormat: SecurityToken
bearerFormat: SecurityToken
98 changes: 95 additions & 3 deletions openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.3
info:
version: 3.2.6
version: 3.2.7
title: Common Data Types
description: |
\*****bzzz*****
Expand Down Expand Up @@ -602,15 +602,28 @@ components:
- $ref: "#/components/schemas/SwarmAddress"
- $ref: "#/components/schemas/SwarmEncryptedReference"

PinCheckResponse:
type: object
properties:
reference:
$ref: "#/components/schemas/SwarmOnlyReference"
total:
type: integer
missing:
type: integer
invalid:
type: integer

SwarmOnlyReferencesList:
type: object
properties:
references:
reference:
type: array
nullable: false
items:
$ref: "#/components/schemas/SwarmOnlyReference"


SwarmReference:
oneOf:
- $ref: "#/components/schemas/SwarmAddress"
Expand Down Expand Up @@ -839,6 +852,8 @@ components:
type: integer
reserveSize:
type: integer
reserveSizeWithinRadius:
type: interger
pullsyncRate:
type: number
storageRadius:
Expand All @@ -864,6 +879,83 @@ components:
items:
$ref: "#/components/schemas/StatusSnapshotResponse"

ApiChunkInclusionProof:
type: object
properties:
chunkSpan:
minimum: 0
type: integer
postageProof:
$ref: '#/components/schemas/ApiPostageProof'
proofSegments:
items:
type: string
nullable: true
type: array
proofSegments2:
items:
type: string
nullable: true
type: array
proofSegments3:
items:
type: string
nullable: true
type: array
proveSegment:
type: string
proveSegment2:
type: string
socProof:
items:
$ref: '#/components/schemas/ApiSOCProof'
nullable: true
type: array

ApiChunkInclusionProofs:
type: object
properties:
proof1:
$ref: '#/components/schemas/ApiChunkInclusionProof'
proof2:
$ref: '#/components/schemas/ApiChunkInclusionProof'
proofLast:
$ref: '#/components/schemas/ApiChunkInclusionProof'

ApiPostageProof:
type: object
properties:
index:
type: string
postageId:
type: string
signature:
type: string
timeStamp:
type: string

ApiRCHashResponse:
type: object
properties:
duration:
type: integer
hash:
$ref: '#/components/schemas/SwarmAddress'
proofs:
$ref: '#/components/schemas/ApiChunkInclusionProofs'

ApiSOCProof:
type: object
properties:
chunkAddr:
type: string
identifier:
type: string
signature:
type: string
signer:
type: string

headers:
SwarmTag:
description: "Tag UID"
Expand Down Expand Up @@ -1080,4 +1172,4 @@ components:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ProblemDetails"
$ref: "#/components/schemas/ProblemDetails"
45 changes: 44 additions & 1 deletion openapi/SwarmDebug.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.3
info:
version: 4.1.0
version: 4.1.1
title: Bee Debug API
description: "A list of the currently provided debug interfaces to interact with the bee node"

Expand Down Expand Up @@ -689,6 +689,41 @@ paths:
$ref: "SwarmCommon.yaml#/components/responses/500"
default:
description: Default response
"/wallet/withdraw/{coin}":
post:
summary: Allows withdrawals of BZZ or xDAI to provided (whitelisted) address
tags:
- Wallet
parameters:
- in: query
name: amount
required: true
schema:
$ref: "#/components/schemas/BigInt"
- in: query
name: address
required: true
schema:
$ref: "#/components/schemas/EthereumAddress"
- in: path
name: coin
required: true
schema:
$ref: "#/components/schemas/SwarmAddress"
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/WalletTxResponse'
description: OK
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
description: Amount greater than ballance or coin is other than BZZ/xDAI
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"
default:
description: Default response

"/transactions":
get:
Expand Down Expand Up @@ -1133,3 +1168,11 @@ paths:
$ref: "SwarmCommon.yaml#/components/responses/400"
default:
description: Default response.

components:
schemas:
WalletTxResponse:
type: object
properties:
transactionHash:
$ref: "#/components/schemas/TransactionHash"

0 comments on commit 8dbd767

Please sign in to comment.