mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-05-11 14:20:19 -05:00
[release] v0.22.0-unstable07
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.22.0-unstable06",
|
||||
"version": "0.22.0-unstable07",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
||||
@@ -3,7 +3,7 @@ set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
VERSION=$(jq -r .version package.json)
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
|
||||
echo "Generating API spec and Go SDK for v${VERSION}..."
|
||||
|
||||
@@ -18,12 +18,14 @@ npx swagger2openapi api-docs/swagger.json -o api-docs/openapi.json
|
||||
|
||||
# 4. Patch OpenAPI spec: replace Go stdlib types with simple schemas
|
||||
# (os.FileMode, time.Duration, nat.PortSet produce uncompilable generated code)
|
||||
jq '
|
||||
.components.schemas["os.FileMode"] = {"type": "integer", "format": "uint32"} |
|
||||
.components.schemas["time.Duration"] = {"type": "integer", "format": "int64"} |
|
||||
.components.schemas["nat.PortSet"] = {"type": "object", "additionalProperties": true}
|
||||
' api-docs/openapi.json > api-docs/openapi.patched.json
|
||||
mv api-docs/openapi.patched.json api-docs/openapi.json
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const spec = JSON.parse(fs.readFileSync('api-docs/openapi.json', 'utf8'));
|
||||
spec.components.schemas['os.FileMode'] = {type: 'integer', format: 'uint32'};
|
||||
spec.components.schemas['time.Duration'] = {type: 'integer', format: 'int64'};
|
||||
spec.components.schemas['nat.PortSet'] = {type: 'object', additionalProperties: true};
|
||||
fs.writeFileSync('api-docs/openapi.json', JSON.stringify(spec, null, 2));
|
||||
"
|
||||
|
||||
# 5. Generate Go SDK client (using go run — no install needed)
|
||||
cd go-sdk
|
||||
|
||||
+1
-1
@@ -201,7 +201,7 @@ func main() {
|
||||
}
|
||||
|
||||
// @title Cosmos Server API
|
||||
// @version 0.22.0-unstable04
|
||||
// @version 0.22.0-unstable07
|
||||
// @description REST API for Cosmos Cloud server management
|
||||
// @BasePath /cosmos
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
|
||||
Reference in New Issue
Block a user