From 0165d506b20b4d50f2339eb2f16774ef71e904af Mon Sep 17 00:00:00 2001 From: feba66 Date: Tue, 13 Jun 2023 23:32:17 +0200 Subject: [PATCH 01/14] Removed duplicate Faction symbol definition --- models/FactionSymbols.json | 2 +- models/SystemFaction.json | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/models/FactionSymbols.json b/models/FactionSymbols.json index ecdd6e0..520ac91 100644 --- a/models/FactionSymbols.json +++ b/models/FactionSymbols.json @@ -1,6 +1,6 @@ { "type": "string", - "description": "Faction symbol.", + "description": "The symbol of the faction.", "minLength": 1, "enum": [ "COSMIC", diff --git a/models/SystemFaction.json b/models/SystemFaction.json index 4a6fba6..aa2a0ef 100644 --- a/models/SystemFaction.json +++ b/models/SystemFaction.json @@ -2,9 +2,7 @@ "type": "object", "properties": { "symbol": { - "type": "string", - "minLength": 1, - "description": "The symbol of the faction." + "$ref": "./FactionSymbols.json" } }, "required": [ From b01b55fd14523abda6b80f01d111cd48db0fb22f Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Sat, 17 Jun 2023 08:04:19 -0700 Subject: [PATCH 02/14] fix: ship refine 201 response --- reference/SpaceTraders.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index a9a56d4..5b28c2a 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -1548,11 +1548,11 @@ } }, "responses": { - "200": { + "201": { "content": { "application/json": { "schema": { - "title": "Ship Refine 200 Response", + "title": "Ship Refine 201 Response", "type": "object", "properties": { "data": { From 7685727af7dc3d9c107a861a0407ea04d7c9d1ab Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Sat, 17 Jun 2023 08:27:48 -0700 Subject: [PATCH 03/14] add optional units to refuel request --- reference/SpaceTraders.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 5b28c2a..7ce3e30 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -2624,6 +2624,23 @@ "post": { "description": "Refuel your ship by buying fuel from the local market.\n\nRequires the ship to be docked in a waypoint that has the `Marketplace` trait, and the market must be selling fuel in order to refuel.\n\nEach fuel bought from the market replenishes 100 units in your ship's fuel.\n\nShips will always be refuel to their frame's maximum fuel capacity when using this action.", "operationId": "refuel-ship", + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "units": { + "type": "integer", + "description": "The amount of fuel to fill in the ship's tanks. When not specified, the ship will be refueled to its maximum fuel capacity. If the amount specified is greater than the ship's remaining capacity, the ship will only be refueled to its maximum fuel capacity. The amount specified is not in market units but in ship fuel units.", + "example": "100", + "minimum": 1 + } + } + } + } + } + }, "responses": { "200": { "content": { From 15be27fd58afb56e4d9606818625630cdfc043d7 Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Sat, 17 Jun 2023 08:47:13 -0700 Subject: [PATCH 04/14] fix transaction response on ship install / remove --- models/ShipModificationTransaction.json | 35 +++++++++++++++++++++++++ reference/SpaceTraders.json | 4 +-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 models/ShipModificationTransaction.json diff --git a/models/ShipModificationTransaction.json b/models/ShipModificationTransaction.json new file mode 100644 index 0000000..eb1e504 --- /dev/null +++ b/models/ShipModificationTransaction.json @@ -0,0 +1,35 @@ +{ + "type": "object", + "properties": { + "waypointSymbol": { + "type": "string", + "description": "The symbol of the waypoint where the transaction took place." + }, + "shipSymbol": { + "type": "string", + "description": "The symbol of the ship that made the transaction." + }, + "tradeSymbol": { + "type": "string", + "description": "The symbol of the trade good." + }, + "totalPrice": { + "type": "integer", + "description": "The total price of the transaction.", + "minimum": 0 + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "The timestamp of the transaction." + } + }, + "required": [ + "waypointSymbol", + "shipSymbol", + "tradeSymbol", + "totalPrice", + "timestamp" + ], + "description": "Result of a transaction for a ship modification, such as installing a mount or a module." +} \ No newline at end of file diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 7ce3e30..ec1b028 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -3030,7 +3030,7 @@ "$ref": "../models/ShipCargo.json" }, "transaction": { - "$ref": "../models/ShipyardTransaction.json" + "$ref": "../models/ShipModificationTransaction.json" } } } @@ -3120,7 +3120,7 @@ "$ref": "../models/ShipCargo.json" }, "transaction": { - "$ref": "../models/ShipyardTransaction.json" + "$ref": "../models/ShipModificationTransaction.json" } } } From 9a4b375ec558c2d0587db8b7917683e793df7719 Mon Sep 17 00:00:00 2001 From: feba66 Date: Sat, 17 Jun 2023 21:27:35 +0200 Subject: [PATCH 05/14] remove security from /register --- reference/SpaceTraders.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index ec1b028..276485d 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -325,13 +325,7 @@ } }, "summary": "Register New Agent", - "tags": [], - "security": [ - {}, - { - "AgentToken": [] - } - ] + "tags": [] } }, "/systems": { @@ -3146,4 +3140,4 @@ } } } -} \ No newline at end of file +} From b792362027aa9a0dbe79f37e7a9295d878c6f80d Mon Sep 17 00:00:00 2001 From: feba66 Date: Sat, 17 Jun 2023 21:29:13 +0200 Subject: [PATCH 06/14] fix: accidentaly removed whole security on /register --- reference/SpaceTraders.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 276485d..848ed86 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -325,7 +325,8 @@ } }, "summary": "Register New Agent", - "tags": [] + "tags": [], + "security": [] } }, "/systems": { From 0d7bb3cca99ae5092342a875831f42be43cb18e9 Mon Sep 17 00:00:00 2001 From: Justin Auger Date: Sat, 24 Jun 2023 05:35:42 +0100 Subject: [PATCH 07/14] Add a github action that generates a couple of clients using openapi generator (#60) Adds a quick layer of validation at CI level. --- .github/workflows/validate.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..83b25ac --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,26 @@ +name: Validate OpenAPI Spec + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + generate: + runs-on: ubuntu-latest + name: Generate Clients + steps: + - uses: actions/checkout@v2 + + - name: Typescript Axios + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: typescript-axios + openapi-file: ./reference/SpaceTraders.json + + - name: Dart + uses: openapi-generators/openapitools-generator-action@v1 + with: + generator: dart + openapi-file: ./reference/SpaceTraders.json From da4cb1edbb4e67615a6c1ade9a9d64702593713d Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Fri, 23 Jun 2023 21:45:19 -0700 Subject: [PATCH 08/14] fix: required fields on refine response --- reference/SpaceTraders.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 848ed86..64402d3 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -1579,7 +1579,11 @@ "type": "integer", "description": "Amount of units of the good." } - } + }, + "required": [ + "tradeSymbol", + "units" + ] } }, "consumed": { @@ -1596,7 +1600,11 @@ "type": "integer", "description": "Amount of units of the good." } - } + }, + "required": [ + "tradeSymbol", + "units" + ] } } } @@ -3141,4 +3149,4 @@ } } } -} +} \ No newline at end of file From bab49f156bf71028bb5fd3428a44a3064b140726 Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Fri, 23 Jun 2023 21:50:35 -0700 Subject: [PATCH 09/14] update: fix description of date field --- reference/SpaceTraders.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 64402d3..b039e4f 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -79,7 +79,7 @@ }, "resetDate": { "type": "string", - "description": "The date and time when the game server was last reset." + "description": "The date when the game server was last reset." }, "description": { "type": "string" From 3c1c694047ceda271cc839fbea9efa0d771c6c13 Mon Sep 17 00:00:00 2001 From: SpaceAdmiral Date: Fri, 23 Jun 2023 21:51:05 -0700 Subject: [PATCH 10/14] fix: bug where minimum was on a date time field --- models/Survey.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/Survey.json b/models/Survey.json index 7cd4f44..178ab48 100644 --- a/models/Survey.json +++ b/models/Survey.json @@ -22,8 +22,7 @@ "expiration": { "type": "string", "format": "date-time", - "description": "The date and time when the survey expires. After this date and time, the survey will no longer be available for extraction.", - "minimum": 0 + "description": "The date and time when the survey expires. After this date and time, the survey will no longer be available for extraction." }, "size": { "type": "string", From 6379a3c27f5bc5a3b7338882f0b24b588b375db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Baumk=C3=B6tter?= Date: Tue, 11 Jul 2023 23:44:03 +0000 Subject: [PATCH 11/14] public agent endpoints --- models/Agent.json | 7 ++- reference/SpaceTraders.json | 114 ++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 2 deletions(-) diff --git a/models/Agent.json b/models/Agent.json index 2cc3710..f971d08 100644 --- a/models/Agent.json +++ b/models/Agent.json @@ -5,7 +5,7 @@ "accountId": { "type": "string", "minLength": 1, - "description": "Account ID that is tied to this agent." + "description": "Account ID that is tied to this agent. Only included on your own agent." }, "symbol": { "type": "string", @@ -26,10 +26,13 @@ "type": "string", "minLength": 1, "description": "The faction the agent started with." + }, + "shipCount": { + "type": "integer", + "description": "How many ships are owned by the agent." } }, "required": [ - "accountId", "symbol", "headquarters", "credits", diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index b039e4f..4a827aa 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -858,6 +858,120 @@ } ] }, + "/agents": { + "get": { + "description": "Fetch agents details.", + "operationId": "get-agents", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "items": { + "$ref": "../models/Agent.json" + }, + "type": "array" + }, + "meta": { + "$ref": "../models/Meta.json" + } + }, + "required": [ + "data", + "meta" + ], + "type": "object" + } + } + }, + "description": "Successfully fetched agents details." + } + }, + "summary": "List Agents", + "tags": [ + "Agents" + ], + "parameters": [ + { + "schema": { + "type": "integer", + "minimum": 1, + "default": 1 + }, + "in": "query", + "name": "page", + "description": "What entry offset to request" + }, + { + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 20, + "default": 10 + }, + "in": "query", + "name": "limit", + "description": "How many entries to return per page" + } + ], + "security": [ + {}, + { + "AgentToken": [] + } + ] + } + }, + "/agents/{agentSymbol}": { + "get": { + "description": "Fetch agent details.", + "operationId": "get-agent", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "$ref": "../models/Agent.json" + } + }, + "required": [ + "data" + ], + "type": "object" + } + } + }, + "description": "Successfully fetched agent details." + } + }, + "summary": "Get Agent", + "tags": [ + "Agents" + ], + "parameters": [ + { + "description": "The agent symbol", + "in": "path", + "name": "agentSymbol", + "required": true, + "schema": { + "default": "FEBA66", + "type": "string" + } + } + ], + "security": [ + {}, + { + "AgentToken": [] + } + ] + } + }, "/my/agent": { "get": { "description": "Fetch your agent's details.", From da649dad933842b5cddb5df3f02585df8ce8ef8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Baumk=C3=B6tter?= Date: Wed, 12 Jul 2023 14:47:04 +0000 Subject: [PATCH 12/14] renamed the new endpoints --- reference/SpaceTraders.json | 72 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/reference/SpaceTraders.json b/reference/SpaceTraders.json index 4a827aa..e679ca0 100644 --- a/reference/SpaceTraders.json +++ b/reference/SpaceTraders.json @@ -858,6 +858,41 @@ } ] }, + "/my/agent": { + "get": { + "description": "Fetch your agent's details.", + "operationId": "get-my-agent", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "$ref": "../models/Agent.json" + } + }, + "required": [ + "data" + ], + "type": "object" + } + } + }, + "description": "Successfully fetched agent details." + } + }, + "security": [ + { + "AgentToken": [] + } + ], + "summary": "Get Agent", + "tags": [ + "Agents" + ] + } + }, "/agents": { "get": { "description": "Fetch agents details.", @@ -948,7 +983,7 @@ "description": "Successfully fetched agent details." } }, - "summary": "Get Agent", + "summary": "Get Public Agent", "tags": [ "Agents" ], @@ -972,41 +1007,6 @@ ] } }, - "/my/agent": { - "get": { - "description": "Fetch your agent's details.", - "operationId": "get-my-agent", - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "properties": { - "data": { - "$ref": "../models/Agent.json" - } - }, - "required": [ - "data" - ], - "type": "object" - } - } - }, - "description": "Successfully fetched agent details." - } - }, - "security": [ - { - "AgentToken": [] - } - ], - "summary": "Get Agent", - "tags": [ - "Agents" - ] - } - }, "/my/contracts": { "get": { "description": "Return a paginated list of all your contracts.", From 1771f4a5a92c370cb75b083292f46e54bc3e3e10 Mon Sep 17 00:00:00 2001 From: feba66 Date: Wed, 19 Jul 2023 01:45:37 +0200 Subject: [PATCH 13/14] Update Agent.json added max len to agent symbol --- models/Agent.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/Agent.json b/models/Agent.json index f971d08..584c9ce 100644 --- a/models/Agent.json +++ b/models/Agent.json @@ -10,6 +10,7 @@ "symbol": { "type": "string", "minLength": 1, + "maxLength": 14, "description": "Symbol of the agent." }, "headquarters": { @@ -38,4 +39,4 @@ "credits", "startingFaction" ] -} \ No newline at end of file +} From c11ab9a9282e64f33f6072a29bfe135e39a18372 Mon Sep 17 00:00:00 2001 From: feba66 Date: Wed, 19 Jul 2023 02:02:47 +0200 Subject: [PATCH 14/14] Update Agent.json symbol minlen fixed --- models/Agent.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/Agent.json b/models/Agent.json index 584c9ce..610526e 100644 --- a/models/Agent.json +++ b/models/Agent.json @@ -9,7 +9,7 @@ }, "symbol": { "type": "string", - "minLength": 1, + "minLength": 3, "maxLength": 14, "description": "Symbol of the agent." },