From 02a74a39318bc4a9222e0d20b0d9b8bd968f84c3 Mon Sep 17 00:00:00 2001 From: Casper-NS <37834568+Casper-NS@users.noreply.github.com> Date: Fri, 17 Nov 2023 13:09:07 +0100 Subject: [PATCH] added postman api integration --- .github/workflows/postman.yml | 9 +- .postman/api | 4 + .../api_73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 | 20 +++ index.json | 119 ++++++++++++++++++ 4 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 .postman/api create mode 100644 .postman/api_73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 create mode 100644 index.json diff --git a/.github/workflows/postman.yml b/.github/workflows/postman.yml index 3376ea9..571e7fd 100644 --- a/.github/workflows/postman.yml +++ b/.github/workflows/postman.yml @@ -7,13 +7,6 @@ on: branches: [ master ] jobs: - start-api: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Run API - run: dotnet run --project CentralHub.Api/CentralHub.Api.csproj - automated-api-tests: runs-on: ubuntu-latest steps: @@ -25,4 +18,4 @@ jobs: run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }} - name: Run API tests run: | - postman collection run "31208196-ebe740bc-2741-48ef-bdb6-e9ad85e8d39a" \ No newline at end of file + postman collection run "31208196-ebe740bc-2741-48ef-bdb6-e9ad85e8d39a" --reporters cli,junit --global-var api_url=http://localhost:8081 \ No newline at end of file diff --git a/.postman/api b/.postman/api new file mode 100644 index 0000000..a1d7485 --- /dev/null +++ b/.postman/api @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY +apis[] = {"apiId":"73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2"} +configVersion = 1.0.0 +type = api diff --git a/.postman/api_73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 b/.postman/api_73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 new file mode 100644 index 0000000..2a62c81 --- /dev/null +++ b/.postman/api_73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 @@ -0,0 +1,20 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY +configVersion = 1.1.0 +type = apiEntityData + +[config] +id = 73c72b7f-85af-473f-ac2e-bbcd0e3bd2c2 + +[config.relations] + +[config.relations.collections] +rootDirectory = postman/collections + +[config.relations.collections.metaData] + +[config.relations.apiDefinition] +files[] = {"path":"index.json","metaData":{}} + +[config.relations.apiDefinition.metaData] +type = openapi:3 +rootFiles[] = index.json diff --git a/index.json b/index.json new file mode 100644 index 0000000..771180c --- /dev/null +++ b/index.json @@ -0,0 +1,119 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "Sample API", + "description": "Buy or rent spacecrafts" + }, + "paths": { + "/spacecrafts/{spacecraftId}": { + "parameters": [ + { + "name": "spacecraftId", + "description": "The unique identifier of the spacecraft", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/SpacecraftId" + } + } + ], + "get": { + "summary": "Read a spacecraft", + "responses": { + "200": { + "description": "The spacecraft corresponding to the provided `spacecraftId`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Spacecraft" + } + } + } + }, + "404": { + "description": "No spacecraft found for the provided `spacecraftId`", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "SpacecraftId": { + "description": "The unique identifier of a spacecraft", + "type": "string" + }, + "Spacecraft": { + "type": "object", + "required": [ + "id", + "name", + "type" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/SpacecraftId" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "capsule", + "probe", + "satellite", + "spaceplane", + "station" + ] + }, + "description": { + "type": "string" + } + } + }, + "Error": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "description": "A human readable error message", + "type": "string" + } + } + } + }, + "securitySchemes": { + "ApiKey": { + "type": "apiKey", + "in": "header", + "name": "X-Api-Key" + } + } + }, + "security": [ + { + "ApiKey": [] + } + ] +} \ No newline at end of file