Skip to content

Commit

Permalink
Merge pull request #30 from Etherna/improve/BNET-78-bee-1.18.2-support
Browse files Browse the repository at this point in the history
Improve/bnet 78 bee 1.18.2 support
  • Loading branch information
tmm360 authored Mar 17, 2024
2 parents 71082fa + 74ebd79 commit 63086af
Show file tree
Hide file tree
Showing 9 changed files with 1,781 additions and 3,340 deletions.
2,008 changes: 654 additions & 1,354 deletions src/BeeNet/Clients/DebugApi/v5_0_0/BeeDebugClient_5_0_0.cs

Large diffs are not rendered by default.

2,740 changes: 902 additions & 1,838 deletions src/BeeNet/Clients/GatewayApi/v5_0_0/BeeGatewayClient_5_0_0.cs

Large diffs are not rendered by default.

308 changes: 173 additions & 135 deletions tools/GatewaySwarm.yaml

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
Use client generation tool
--------------------------
# Use client generation tool

NSwag doesn't support multiple OpenAPI configuration files. They needs to be merged.

We are using `speccy` tool (https://github.com/wework/speccy) with these command:

```
speccy resolve -i .\openapi\Swarm.yaml -o GatewaySwarm.yaml
speccy resolve -i .\openapi\SwarmDebug.yaml -o DebugSwarm.yaml
```shell
speccy resolve -i ./openapi/Swarm.yaml -o GatewaySwarm.yaml
speccy resolve -i ./openapi/SwarmDebug.yaml -o DebugSwarm.yaml
```

How to versioning openapi/*.yaml:
- copy *.yaml from official https://github.com/ethersphere/bee/tree/master/openapi in tools/original-open-api
- merge tools/original-open-api in new feature/BNET-xx-Beex.x.x

# Use Nswag

Use Nswag to generate client code. Use NSwagStudio for Windows, or NSwag Cli with others.

NSwag Cli:

```shell
nswag run swarm-debug-api.nswag
nswag run swarm-gateway-api.nswag
```
27 changes: 25 additions & 2 deletions tools/openapi/Swarm.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3

info:
version: 5.1.0
version: 5.1.1
title: Bee API
description: "A list of the currently provided Interfaces to interact with the swarm, implementing file operations and sending messages"

Expand Down Expand Up @@ -158,6 +158,11 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true
description: Swarm address reference to content
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmCache"
name: swarm-cache
required: false
responses:
"200":
description: Retrieved content specified by reference
Expand Down Expand Up @@ -300,6 +305,11 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true
description: Swarm address of content
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmCache"
name: swarm-cache
required: false
responses:
"200":
description: Ok
Expand Down Expand Up @@ -669,6 +679,14 @@ paths:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmPostageBatchId"
name: swarm-postage-batch-id
required: true
requestBody:
required: true
description: The SOC binary data is composed of the span (8 bytes) and the at most 4KB payload.
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
"201":
description: Created
Expand Down Expand Up @@ -1057,6 +1075,11 @@ paths:
$ref: "SwarmCommon.yaml#/components/schemas/SwarmReference"
required: true
description: Swarm address of chunk
- in: header
schema:
$ref: "SwarmCommon.yaml#/components/parameters/SwarmCache"
name: swarm-cache
required: false
responses:
"200":
description: Retrieved chunk content
Expand Down Expand Up @@ -1896,4 +1919,4 @@ components:
bearerAuth:
type: http
scheme: bearer
bearerFormat: SecurityToken
bearerFormat: SecurityToken
11 changes: 10 additions & 1 deletion tools/openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,15 @@ components:
description: >
Determines if the uploaded data should be sent to the network immediately or in a deferred fashion. By default the upload will be direct.
SwarmCache:
in: header
name: swarm-cache
schema:
type: boolean
default: "true"
required: false
description: "Determines if the download data should be cached on the node. By default the download will be cached"

responses:
"204":
description: The resource was deleted successfully.
Expand Down Expand Up @@ -1039,4 +1048,4 @@ components:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ProblemDetails"
$ref: "#/components/schemas/ProblemDetails"
2 changes: 1 addition & 1 deletion tools/openapi/SwarmDebug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1135,4 +1135,4 @@ paths:
"400":
$ref: "SwarmCommon.yaml#/components/responses/400"
default:
description: Default response.
description: Default response.
4 changes: 2 additions & 2 deletions tools/swarm-debug-api.nswag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"runtime": "Net70",
"runtime": "Net80",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
Expand Down Expand Up @@ -99,4 +99,4 @@
"newLineBehavior": "Auto"
}
}
}
}
4 changes: 2 additions & 2 deletions tools/swarm-gateway-api.nswag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"runtime": "Net70",
"runtime": "Net80",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
Expand Down Expand Up @@ -99,4 +99,4 @@
"newLineBehavior": "Auto"
}
}
}
}

0 comments on commit 63086af

Please sign in to comment.