Commit c57f0750 authored by Adam Uhlíř's avatar Adam Uhlíř Committed by GitHub

docs: improving openapi docs (#1738)

improve openapi docs, documentaing returned 
null instead of empty array
parent a7c05c20
...@@ -40,6 +40,7 @@ paths: ...@@ -40,6 +40,7 @@ paths:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmEncryptParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmEncryptParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
...@@ -56,6 +57,8 @@ paths: ...@@ -56,6 +57,8 @@ paths:
application/json: application/json:
schema: schema:
$ref: "SwarmCommon.yaml#/components/schemas/ReferenceResponse" $ref: "SwarmCommon.yaml#/components/schemas/ReferenceResponse"
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"403": "403":
$ref: "SwarmCommon.yaml#/components/responses/403" $ref: "SwarmCommon.yaml#/components/responses/403"
"500": "500":
...@@ -131,6 +134,7 @@ paths: ...@@ -131,6 +134,7 @@ paths:
parameters: parameters:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
...@@ -179,6 +183,7 @@ paths: ...@@ -179,6 +183,7 @@ paths:
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmCollection" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmCollection"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmIndexDocumentParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmIndexDocumentParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmErrorDocumentParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmErrorDocumentParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
requestBody: requestBody:
content: content:
multipart/form-data: multipart/form-data:
...@@ -553,6 +558,7 @@ paths: ...@@ -553,6 +558,7 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/PssRecipient" $ref: "SwarmCommon.yaml#/components/schemas/PssRecipient"
required: false required: false
description: Recipient publickey description: Recipient publickey
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
responses: responses:
"201": "201":
description: Subscribed to topic description: Subscribed to topic
...@@ -567,7 +573,7 @@ paths: ...@@ -567,7 +573,7 @@ paths:
get: get:
summary: Subscribe for messages on the given topic. summary: Subscribe for messages on the given topic.
tags: tags:
- Pss subscribe - Postal Service for Swarm
parameters: parameters:
- in: path - in: path
name: topic name: topic
...@@ -649,6 +655,7 @@ paths: ...@@ -649,6 +655,7 @@ paths:
required: false required: false
description: "Feed indexing scheme (default: sequence)" description: "Feed indexing scheme (default: sequence)"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
responses: responses:
"201": "201":
description: Created description: Created
...@@ -718,7 +725,7 @@ paths: ...@@ -718,7 +725,7 @@ paths:
get: get:
summary: Get all available stamps for this node summary: Get all available stamps for this node
tags: tags:
- Get stamp batches - Postage Stamps
responses: responses:
"200": "200":
description: Returns an array of all available postage batches. description: Returns an array of all available postage batches.
...@@ -741,7 +748,7 @@ paths: ...@@ -741,7 +748,7 @@ paths:
get: get:
summary: Get an individual postage batch status summary: Get an individual postage batch status
tags: tags:
- Get stamp batch - Postage Stamps
responses: responses:
"200": "200":
description: Returns an individual postage batch state description: Returns an individual postage batch state
...@@ -755,23 +762,23 @@ paths: ...@@ -755,23 +762,23 @@ paths:
description: Default response description: Default response
"/stamps/{amount}/{depth}": "/stamps/{amount}/{depth}":
get: post:
summary: Buy a new postage batch summary: Buy a new postage batch. \n\n Be aware, this endpoint create an on-chain transactions and transfers BZZ from the node's Ethereum account and hence directly manipulates the wallet balance!
tags: tags:
- Buy stamp batch - Postage Stamps
parameters: parameters:
- in: path - in: path
name: amount name: amount
schema: schema:
type: integer type: integer
required: true required: true
description: Amount added to the balance description: Amount of BZZ added that the postage batch will have.
- in: path - in: path
name: depth name: depth
schema: schema:
type: integer type: integer
required: true required: true
description: Batch depth. Must be higher than default bucket depth (16) description: Batch depth which specifies how many chunks can be signed with the batch. It is a logarithm. Must be higher than default bucket depth (16)
- in: query - in: query
name: label name: label
schema: schema:
......
...@@ -50,19 +50,6 @@ components: ...@@ -50,19 +50,6 @@ components:
items: items:
$ref: "#/components/schemas/Balance" $ref: "#/components/schemas/Balance"
BzzChunksPinned:
type: object
properties:
chunks:
type: array
items:
type: object
properties:
address:
type: string
pinCounter:
type: integer
BzzTopology: BzzTopology:
type: object type: object
properties: properties:
...@@ -106,7 +93,9 @@ components: ...@@ -106,7 +93,9 @@ components:
type: object type: object
properties: properties:
lastcheques: lastcheques:
type: array oneOf:
- $ref: '#/components/schemas/EmptyNull'
- type: array
items: items:
$ref: "#/components/schemas/ChequePeerResponse" $ref: "#/components/schemas/ChequePeerResponse"
...@@ -150,6 +139,10 @@ components: ...@@ -150,6 +139,10 @@ components:
pattern: "^[A-Fa-f0-9]{40}$" pattern: "^[A-Fa-f0-9]{40}$"
example: "36b7efd913ca4cf880b8eeac5093fa27b0825906" example: "36b7efd913ca4cf880b8eeac5093fa27b0825906"
EmptyNull:
type: 'null'
description: When no entries 'null' is returned instead of empty array.
FileName: FileName:
type: string type: string
...@@ -221,7 +214,9 @@ components: ...@@ -221,7 +214,9 @@ components:
type: object type: object
properties: properties:
tags: tags:
type: array oneOf:
- $ref: '#/components/schemas/EmptyNull'
- type: array
items: items:
$ref: "#/components/schemas/NewTagResponse" $ref: "#/components/schemas/NewTagResponse"
...@@ -233,7 +228,9 @@ components: ...@@ -233,7 +228,9 @@ components:
type: object type: object
properties: properties:
peers: peers:
type: array oneOf:
- $ref: '#/components/schemas/EmptyNull'
- type: array
items: items:
$ref: "#/components/schemas/Address" $ref: "#/components/schemas/Address"
...@@ -259,7 +256,9 @@ components: ...@@ -259,7 +256,9 @@ components:
type: object type: object
properties: properties:
stamps: stamps:
$ref: "#/components/schemas/PostageBatches" oneOf:
- $ref: '#/components/schemas/EmptyNull'
- $ref: "#/components/schemas/PostageBatches"
BatchIDResponse: BatchIDResponse:
type: object type: object
...@@ -319,7 +318,9 @@ components: ...@@ -319,7 +318,9 @@ components:
totalSent: totalSent:
type: integer type: integer
settlements: settlements:
type: array oneOf:
- $ref: '#/components/schemas/EmptyNull'
- type: array
items: items:
$ref: "#/components/schemas/Settlement" $ref: "#/components/schemas/Settlement"
...@@ -356,7 +357,9 @@ components: ...@@ -356,7 +357,9 @@ components:
type: object type: object
properties: properties:
addresses: addresses:
type: array oneOf:
- $ref: '#/components/schemas/EmptyNull'
- type: array
items: items:
$ref: "#/components/schemas/SwarmOnlyReference" $ref: "#/components/schemas/SwarmOnlyReference"
...@@ -531,6 +534,14 @@ components: ...@@ -531,6 +534,14 @@ components:
required: false required: false
description: Upload file/files as a collection description: Upload file/files as a collection
SwarmPostageBatchId:
in: header
name: swarm-postage-batch-id
description: "ID of Postage Batch that is used to upload data with"
required: true
schema:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmAddress"
responses: responses:
"204": "204":
description: The resource was deleted successfully. description: The resource was deleted successfully.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment