From a31a2f125e6fea297758f11502601cc466b86094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Thu, 11 Oct 2018 10:43:22 +0200 Subject: [PATCH] update the demo to be more generic --- api-contracts/openapi-spec-v1.0.yaml | 12 ++++----- api-contracts/openapi-spec-v1.1.yaml | 16 +++++------ api-contracts/openapi-spec-v2.0.yaml | 16 +++++------ openapi-spec.yaml | 40 ++++++++++------------------ pipeline-template.yaml | 2 +- postman_collection.json | 36 ++++++++++++------------- server.js | 6 ++--- 7 files changed, 58 insertions(+), 70 deletions(-) diff --git a/api-contracts/openapi-spec-v1.0.yaml b/api-contracts/openapi-spec-v1.0.yaml index 2e81449..5467a8d 100644 --- a/api-contracts/openapi-spec-v1.0.yaml +++ b/api-contracts/openapi-spec-v1.0.yaml @@ -1,22 +1,22 @@ --- swagger: '2.0' info: - title: RHTE API - description: RHTE API v1.0 - An API that gives information about the Red Hat Tech Exchange + title: Red Hat Event API + description: Red Hat Event API v1.0 - An API that gives information about the Red Hat Event version: 1.0.0 paths: /location: get: - summary: Get Next RHTE Location - description: Get the location of the next RedHat Tech Exchange + summary: Get Location + description: Get the location of the next RedHat Event operationId: GetLocation responses: 200: description: OK /timeframe: get: - summary: Get Next RHTE Timeframe - description: Get the timeframe of the next RedHat Tech Exchange + summary: Get Timeframe + description: Get the timeframe of the next RedHat Event operationId: GetTimeframe responses: 200: diff --git a/api-contracts/openapi-spec-v1.1.yaml b/api-contracts/openapi-spec-v1.1.yaml index abe9a0b..c7dddf7 100644 --- a/api-contracts/openapi-spec-v1.1.yaml +++ b/api-contracts/openapi-spec-v1.1.yaml @@ -1,30 +1,30 @@ --- swagger: '2.0' info: - title: RHTE API - description: RHTE API v1.1 - An API that gives information about the Red Hat Tech Exchange + title: Red Hat Event API + description: Red Hat Event API v1.1 - An API that gives information about the Red Hat Event version: 1.1.0 paths: /location: get: - summary: Get Next RHTE Location - description: Get the location of the next RedHat Tech Exchange + summary: Get Location + description: Get the location of the next RedHat Event operationId: GetLocation responses: 200: description: OK /timeframe: get: - summary: Get Next RHTE Timeframe - description: Get the timeframe of the next RedHat Tech Exchange + summary: Get Timeframe + description: Get the timeframe of the next RedHat Event operationId: GetTimeframe responses: 200: description: OK /participants: get: - summary: Get Next RHTE Participants - description: Get the participants of the next RedHat Tech Exchange + summary: Get Participants + description: Get the participants of the next RedHat Event operationId: GetParticipants responses: 200: diff --git a/api-contracts/openapi-spec-v2.0.yaml b/api-contracts/openapi-spec-v2.0.yaml index a7327e5..0f68626 100644 --- a/api-contracts/openapi-spec-v2.0.yaml +++ b/api-contracts/openapi-spec-v2.0.yaml @@ -1,30 +1,30 @@ --- swagger: '2.0' info: - title: RHTE API with OpenID Connect - description: RHTE API v2.0 - An API that gives information about the Red Hat Tech Exchange + title: Red Hat Event API + description: RHTE API v2.0 - An API that gives information about the Red Hat Event version: 2.0.0 paths: /location: get: - summary: Get Next RHTE Location - description: Get the location of the next RedHat Tech Exchange + summary: Get Location + description: Get the location of the next RedHat Event operationId: GetLocation responses: 200: description: OK /timeframe: get: - summary: Get Next RHTE Timeframe - description: Get the timeframe of the next RedHat Tech Exchange + summary: Get Timeframe + description: Get the timeframe of the next RedHat Event operationId: GetTimeframe responses: 200: description: OK /participants: get: - summary: Get Next RHTE Participants - description: Get the participants of the next RedHat Tech Exchange + summary: Get Participants + description: Get the participants of the next RedHat Event operationId: GetParticipants responses: 200: diff --git a/openapi-spec.yaml b/openapi-spec.yaml index e6e48aa..5467a8d 100644 --- a/openapi-spec.yaml +++ b/openapi-spec.yaml @@ -1,43 +1,31 @@ --- -swagger: "2.0" +swagger: '2.0' info: - title: RHTE API with OpenID Connect - description: RHTE API v2.0 - An API that gives information about the Red Hat Tech - Exchange - version: 2.0.0 + title: Red Hat Event API + description: Red Hat Event API v1.0 - An API that gives information about the Red Hat Event + version: 1.0.0 paths: /location: get: - summary: Get Next RHTE Location - description: Get the location of the next RedHat Tech Exchange + summary: Get Location + description: Get the location of the next RedHat Event operationId: GetLocation responses: 200: description: OK /timeframe: get: - summary: Get Next RHTE Timeframe - description: Get the timeframe of the next RedHat Tech Exchange + summary: Get Timeframe + description: Get the timeframe of the next RedHat Event operationId: GetTimeframe responses: 200: description: OK - /participants: - get: - summary: Get Next RHTE Participants - description: Get the participants of the next RedHat Tech Exchange - operationId: GetParticipants - responses: - 200: - description: OK securityDefinitions: - oidc: - type: oauth2 - flow: accessCode - authorizationUrl: https://filled-later.dummy/auth - tokenUrl: https://filled-later.dummy/token - scopes: - openid: Get an OpenID Connect token + apikey: + type: apiKey + description: Use a 3scale API Key + name: api-key + in: header security: -- oidc: - - openid +- apikey: [] diff --git a/pipeline-template.yaml b/pipeline-template.yaml index ef2582c..f8c14e1 100644 --- a/pipeline-template.yaml +++ b/pipeline-template.yaml @@ -105,7 +105,7 @@ parameters: value: http://microcks:8080/api required: true - name: MICROCKS_SERVICE_ID - value: RHTE-API:1.1 + value: RedHat-Event-API:1.1 required: true - name: MICROCKS_TEST_ENDPOINT required: true diff --git a/postman_collection.json b/postman_collection.json index 090fdec..11b2564 100644 --- a/postman_collection.json +++ b/postman_collection.json @@ -1,8 +1,8 @@ { "info": { "_postman_id": "eebbf7c9-f616-4e1e-9128-8f26dec53958", - "name": "RHTE-API", - "description": "version=1.1 - An API that gives information about the Red Hat Tech Exchange", + "name": "RedHat-Event-API", + "description": "version=1.1 - An API that gives information about the next Red Hat Event", "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" }, "item": [ @@ -11,7 +11,7 @@ "description": "Folder for location", "item": [ { - "name": "Get Next Location", + "name": "Get Location", "event": [ { "listen": "test", @@ -19,9 +19,9 @@ "id": "285eeaa2-342e-4136-b58a-ee7992196d8a", "type": "text/javascript", "exec": [ - "pm.test(\"Location is Praha\", function () {", + "pm.test(\"Location is on-line\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.Location).to.eql(\"La Defense\");", + " pm.expect(jsonData.Location).to.eql(\"on-line\");", "});" ] } @@ -32,12 +32,12 @@ "header": [], "body": {}, "url": "http://{{hostname}}/location", - "description": "Get the location of the next RedHat Tech Exchange" + "description": "Get the location of the next Red Hat Event" }, "response": [ { "id": "5fd53940-1fda-49cf-a07a-eba6c91f472d", - "name": "Get Next Location", + "name": "Get Location", "originalRequest": { "method": "GET", "header": [], @@ -57,7 +57,7 @@ } ], "cookie": [], - "body": "{ \n \"Location\": \"La Defense\"\n}\n" + "body": "{ \n \"Location\": \"on-line\"\n}\n" } ] } @@ -68,7 +68,7 @@ "description": "Folder for timeframe", "item": [ { - "name": "Get Next Timeframe", + "name": "Get Timeframe", "event": [ { "listen": "test", @@ -78,8 +78,8 @@ "exec": [ "pm.test(\"Has a From and a To\", function () {", " var jsonData = pm.response.json();", - " pm.expect(jsonData.From).to.eql(\"10/10/2018\");", - " pm.expect(jsonData.To).to.eql(\"10/10/2018\");", + " pm.expect(jsonData.From).to.eql(\"13/11/2018\");", + " pm.expect(jsonData.To).to.eql(\"13/11/2018\");", "});" ] } @@ -90,12 +90,12 @@ "header": [], "body": {}, "url": "http://{{hostname}}/timeframe", - "description": "Get the timeframe of the next RedHat Tech Exchange" + "description": "Get the timeframe of the next Red Hat Event" }, "response": [ { "id": "9c01b8c2-5850-4cae-8795-63ac61a83fb6", - "name": "Get Next Timeframe", + "name": "Get Timeframe", "originalRequest": { "method": "GET", "header": [], @@ -115,7 +115,7 @@ } ], "cookie": [], - "body": "{ \n \"From\": \"10/10/2018\",\n \"To\": \"10/10/2018\"\n}\n" + "body": "{ \n \"From\": \"13/11/2018\",\n \"To\": \"13/11/2018\"\n}\n" } ] } @@ -126,7 +126,7 @@ "description": "Folder for participants", "item": [ { - "name": "Get Next Participants", + "name": "Get Participants", "event": [ { "listen": "test", @@ -147,12 +147,12 @@ "header": [], "body": {}, "url": "http://{{hostname}}/participants", - "description": "Get the participants of the next RedHat Tech Exchange" + "description": "Get the participants of the next Red Hat Event" }, "response": [ { "id": "077baf3d-14f9-4f79-9b18-d4e0c14dcad1", - "name": "Get Next Participants", + "name": "Get Participants", "originalRequest": { "method": "GET", "header": [], @@ -172,7 +172,7 @@ } ], "cookie": [], - "body": "[ \n \"Sebastien\",\n \"Nicolas\"\n]" + "body": "[ \n \"Nicolas\",\n \"Manfred\"\n]" } ] } diff --git a/server.js b/server.js index ab36ddf..a55447a 100644 --- a/server.js +++ b/server.js @@ -9,21 +9,21 @@ router.use(function (req, res, next) { }); router.get("/location", function(req, res) { - var response = { "Location": "La Defense" }; + var response = { "Location": "on-line" }; res.type('application/json') .send(JSON.stringify(response)) .end(); }); router.get("/timeframe",function(req, res) { - var response = { "From": "10/10/2018", "To": "10/10/2018" }; + var response = { "From": "13/11/2018", "To": "13/11/2018" }; res.type('application/json') .send(JSON.stringify(response)) .end(); }); router.get("/participants",function(req, res) { - var response = [ "Sebastien", "Nicolas" ]; + var response = [ "Nicolas", "Manfred" ]; res.type('application/json') .send(JSON.stringify(response)) .end();