Commit 65ec2d0a authored by metacertain's avatar metacertain Committed by GitHub

Openapi headers revised (#1323)

* Openapi headers revised

* Add more Pinning headers
parent 28f54779
openapi: 3.0.3 openapi: 3.0.3
info: info:
version: 0.5.0 version: 0.5.1
title: Swarm API title: Swarm API
description: "A list of the currently provided Interfaces to interact with the swarm, implementing file operations and sending messages" description: "A list of the currently provided Interfaces to interact with the swarm, implementing file operations and sending messages"
...@@ -21,7 +21,6 @@ servers: ...@@ -21,7 +21,6 @@ servers:
port: port:
default: 1633 default: 1633
description: Service port provided in bee node config description: Service port provided in bee node config
- url: "http://{apiRoot}:{port}" - url: "http://{apiRoot}:{port}"
variables: variables:
apiRoot: apiRoot:
...@@ -38,24 +37,9 @@ paths: ...@@ -38,24 +37,9 @@ paths:
tags: tags:
- Bytes - Bytes
parameters: parameters:
- in: header - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
schema: - $ref: "SwarmCommon.yaml#/components/parameters/SwarmEncryptParameter"
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
required: false
description: Associate upload with an existing Tag UID
- in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the bytes
- in: header
name: swarm-encrypt
schema:
type: boolean
required: false
description: Represents the encrypting state of the bytes
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
...@@ -65,6 +49,9 @@ paths: ...@@ -65,6 +49,9 @@ paths:
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-tag":
$ref: "SwarmCommon.yaml#/components/headers/SwarmTag"
content: content:
application/json: application/json:
schema: schema:
...@@ -96,12 +83,8 @@ paths: ...@@ -96,12 +83,8 @@ paths:
schema: schema:
type: string type: string
format: binary format: binary
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
"404": "404":
$ref: "SwarmCommon.yaml#/components/responses/404" $ref: "SwarmCommon.yaml#/components/responses/404"
"500":
$ref: "SwarmCommon.yaml#/components/responses/500"
default: default:
description: Default response description: Default response
...@@ -117,14 +100,20 @@ paths: ...@@ -117,14 +100,20 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference" $ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true required: true
description: Swarm address of chunk description: Swarm address of chunk
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRecoveryTargetsParameter"
responses: responses:
"200": "200":
description: Retrieved chunk content description: Retrieved chunk content
headers:
"swarm-recovery-targets":
$ref: "SwarmCommon.yaml#/components/headers/SwarmRecoveryTargets"
content: content:
application/octet-stream: application/octet-stream:
schema: schema:
type: string type: string
format: binary format: binary
"202":
description: chunk recovery initiated. retry after sometime.
"400": "400":
$ref: "SwarmCommon.yaml#/components/responses/400" $ref: "SwarmCommon.yaml#/components/responses/400"
"404": "404":
...@@ -140,18 +129,8 @@ paths: ...@@ -140,18 +129,8 @@ paths:
tags: tags:
- Chunk - Chunk
parameters: parameters:
- in: header - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
schema:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
required: false
description: Associate upload with an existing Tag UID
- in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the chunk
requestBody: requestBody:
content: content:
application/octet-stream: application/octet-stream:
...@@ -161,6 +140,9 @@ paths: ...@@ -161,6 +140,9 @@ paths:
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-tag":
$ref: "SwarmCommon.yaml#/components/headers/SwarmTag"
content: content:
application/json: application/json:
schema: schema:
...@@ -184,29 +166,10 @@ paths: ...@@ -184,29 +166,10 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/FileName" $ref: "SwarmCommon.yaml#/components/schemas/FileName"
required: false required: false
description: Filename description: Filename
- in: header - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
schema: - $ref: "SwarmCommon.yaml#/components/parameters/SwarmEncryptParameter"
$ref: "SwarmCommon.yaml#/components/schemas/Uid" - $ref: "SwarmCommon.yaml#/components/parameters/ContentTypePreserved"
required: false
description: Associate upload with an existing Tag UID
- in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the file
- in: header
name: swarm-encrypt
schema:
type: boolean
required: false
description: Represents the encrypting state of the file
- in: header
name: Content-Type
schema:
type: string
description: The specified content-type is preserved for download of the asset
requestBody: requestBody:
content: content:
multipart/form-data: multipart/form-data:
...@@ -224,6 +187,11 @@ paths: ...@@ -224,6 +187,11 @@ paths:
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-tag":
$ref: "SwarmCommon.yaml#/components/headers/SwarmTag"
"etag":
$ref: "SwarmCommon.yaml#/components/headers/ETag"
content: content:
application/json: application/json:
schema: schema:
...@@ -249,9 +217,15 @@ paths: ...@@ -249,9 +217,15 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference" $ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true required: true
description: Swarm address of content description: Swarm address of content
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmRecoveryTargetsParameter"
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-recovery-targets":
$ref: "SwarmCommon.yaml#/components/headers/SwarmRecoveryTargets"
"ETag":
$ref: "SwarmCommon.yaml#/components/headers/ETag"
content: content:
application/octet-stream: application/octet-stream:
schema: schema:
...@@ -272,38 +246,12 @@ paths: ...@@ -272,38 +246,12 @@ paths:
tags: tags:
- Collection - Collection
parameters: parameters:
- in: header - $ref: "SwarmCommon.yaml#/components/parameters/SwarmTagParameter"
name: swarm-tag - $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
schema: - $ref: "SwarmCommon.yaml#/components/parameters/SwarmEncryptParameter"
$ref: "SwarmCommon.yaml#/components/schemas/Uid" - $ref: "SwarmCommon.yaml#/components/parameters/SwarmIndexDocumentParameter"
required: false - $ref: "SwarmCommon.yaml#/components/parameters/SwarmErrorDocumentParameter"
description: Associate upload with an existing Tag UID - $ref: "SwarmCommon.yaml#/components/parameters/ContentTypePreserved"
- in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the collection
- in: header
name: swarm-encrypt
schema:
type: boolean
required: false
description: Represents the encrypting state of the collection
- in: header
name: swarm-index-document
schema:
type: string
example: index.html
required: false
description: Default file to be referenced on path, if exists under that path
- in: header
name: swarm-error-document
schema:
type: string
example: error.html
required: false
description: Configure custom error document to be returned when a specified path can not be found in collection
requestBody: requestBody:
content: content:
application/x-tar: application/x-tar:
...@@ -313,6 +261,9 @@ paths: ...@@ -313,6 +261,9 @@ paths:
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-tag":
$ref: "SwarmCommon.yaml#/components/headers/SwarmTag"
content: content:
application/json: application/json:
schema: schema:
...@@ -338,21 +289,20 @@ paths: ...@@ -338,21 +289,20 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference" $ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true required: true
description: Swarm address of content description: Swarm address of content
- in: query - $ref: "SwarmCommon.yaml#/components/parameters/SwarmRecoveryTargetsParameter"
name: targets
schema:
type: string
required: false
description: Global pinning targets prefix
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-recovery-targets":
$ref: "SwarmCommon.yaml#/components/headers/SwarmRecoveryTargets"
# "swarm-feed-index":
# $ref: "SwarmCommon.yaml#/components/headers/SwarmFeedIndex"
content: content:
application/octet-stream: application/octet-stream:
schema: schema:
type: string type: string
format: binary format: binary
"400": "400":
$ref: "SwarmCommon.yaml#/components/responses/400" $ref: "SwarmCommon.yaml#/components/responses/400"
"404": "404":
...@@ -380,15 +330,13 @@ paths: ...@@ -380,15 +330,13 @@ paths:
type: string type: string
required: true required: true
description: Path to the file in the collection. description: Path to the file in the collection.
- in: query - $ref: "SwarmCommon.yaml#/components/parameters/SwarmRecoveryTargetsParameter"
name: targets
schema:
type: string
required: false
description: Global pinning targets prefix
responses: responses:
"200": "200":
description: Ok description: Ok
headers:
"swarm-recovery-targets":
$ref: "SwarmCommon.yaml#/components/headers/SwarmRecoveryTargets"
content: content:
application/octet-stream: application/octet-stream:
schema: schema:
...@@ -888,6 +836,7 @@ paths: ...@@ -888,6 +836,7 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/HexString" $ref: "SwarmCommon.yaml#/components/schemas/HexString"
required: true required: true
description: Signature description: Signature
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
responses: responses:
"201": "201":
description: Created description: Created
...@@ -928,6 +877,7 @@ paths: ...@@ -928,6 +877,7 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/FeedType" $ref: "SwarmCommon.yaml#/components/schemas/FeedType"
required: false required: false
description: "Feed indexing scheme (default: sequence)" description: "Feed indexing scheme (default: sequence)"
- $ref: "SwarmCommon.yaml#/components/parameters/SwarmPinParameter"
responses: responses:
"201": "201":
description: Created description: Created
......
openapi: 3.0.3 openapi: 3.0.3
info: info:
version: 0.5.0 version: 0.5.1
title: Common Data Types title: Common Data Types
description: | description: |
\*****bzzz***** \*****bzzz*****
...@@ -382,15 +382,95 @@ components: ...@@ -382,15 +382,95 @@ components:
pattern: "^(sequence|epoch)$" pattern: "^(sequence|epoch)$"
headers: headers:
SwarmTag:
description: "Tag UID"
schema:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
SwarmFeedIndex: SwarmFeedIndex:
description: "The index of the found update" description: "The index of the found update"
schema: schema:
$ref: "#/components/schemas/HexString" $ref: "#/components/schemas/HexString"
SwarmFeedIndexNext: SwarmFeedIndexNext:
description: "The index of the next possible update" description: "The index of the next possible update"
schema: schema:
$ref: "#/components/schemas/HexString" $ref: "#/components/schemas/HexString"
SwarmRecoveryTargets:
description: "The targets provided for recovery"
schema:
type: string
ETag:
description: |
The RFC7232 ETag header field in a response provides the current entity-
tag for the selected resource. An entity-tag is an opaque identifier for
different versions of a resource over time, regardless whether multiple
versions are valid at the same time. An entity-tag consists of an opaque
quoted string, possibly prefixed by a weakness indicator.
schema:
type: string
parameters:
SwarmRecoveryTargetsParameter:
in: query
name: targets
schema:
type: string
required: false
description: Global pinning targets prefix
SwarmTagParameter:
in: header
name: swarm-tag
schema:
$ref: "SwarmCommon.yaml#/components/schemas/Uid"
required: false
description: Associate upload with an existing Tag UID
SwarmPinParameter:
in: header
name: swarm-pin
schema:
type: boolean
required: false
description: Represents the pinning state of the chunk
SwarmEncryptParameter:
in: header
name: swarm-encrypt
schema:
type: boolean
required: false
description: Represents the encrypting state of the file
ContentTypePreserved:
in: header
name: Content-Type
schema:
type: string
description: The specified content-type is preserved for download of the asset
SwarmIndexDocumentParameter:
in: header
name: swarm-index-document
schema:
type: string
example: index.html
required: false
description: Default file to be referenced on path, if exists under that path
SwarmErrorDocumentParameter:
in: header
name: swarm-error-document
schema:
type: string
example: error.html
required: false
description: Configure custom error document to be returned when a specified path can not be found in collection
responses: responses:
"204": "204":
description: The resource was deleted successfully. description: The resource was deleted successfully.
......
openapi: 3.0.3 openapi: 3.0.3
info: info:
version: 0.5.0 version: 0.5.1
title: Bee Debug API title: Bee Debug API
description: "A list of the currently provided debug interfaces to interact with the bee node" description: "A list of the currently provided debug interfaces to interact with the bee node"
......
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