Browse Source

update the demo to be more generic

master
Nicolas Massé 7 years ago
parent
commit
a31a2f125e
  1. 12
      api-contracts/openapi-spec-v1.0.yaml
  2. 16
      api-contracts/openapi-spec-v1.1.yaml
  3. 16
      api-contracts/openapi-spec-v2.0.yaml
  4. 40
      openapi-spec.yaml
  5. 2
      pipeline-template.yaml
  6. 36
      postman_collection.json
  7. 6
      server.js

12
api-contracts/openapi-spec-v1.0.yaml

@ -1,22 +1,22 @@
--- ---
swagger: '2.0' swagger: '2.0'
info: info:
title: RHTE API title: Red Hat Event API
description: RHTE API v1.0 - An API that gives information about the Red Hat Tech Exchange description: Red Hat Event API v1.0 - An API that gives information about the Red Hat Event
version: 1.0.0 version: 1.0.0
paths: paths:
/location: /location:
get: get:
summary: Get Next RHTE Location summary: Get Location
description: Get the location of the next RedHat Tech Exchange description: Get the location of the next RedHat Event
operationId: GetLocation operationId: GetLocation
responses: responses:
200: 200:
description: OK description: OK
/timeframe: /timeframe:
get: get:
summary: Get Next RHTE Timeframe summary: Get Timeframe
description: Get the timeframe of the next RedHat Tech Exchange description: Get the timeframe of the next RedHat Event
operationId: GetTimeframe operationId: GetTimeframe
responses: responses:
200: 200:

16
api-contracts/openapi-spec-v1.1.yaml

@ -1,30 +1,30 @@
--- ---
swagger: '2.0' swagger: '2.0'
info: info:
title: RHTE API title: Red Hat Event API
description: RHTE API v1.1 - An API that gives information about the Red Hat Tech Exchange description: Red Hat Event API v1.1 - An API that gives information about the Red Hat Event
version: 1.1.0 version: 1.1.0
paths: paths:
/location: /location:
get: get:
summary: Get Next RHTE Location summary: Get Location
description: Get the location of the next RedHat Tech Exchange description: Get the location of the next RedHat Event
operationId: GetLocation operationId: GetLocation
responses: responses:
200: 200:
description: OK description: OK
/timeframe: /timeframe:
get: get:
summary: Get Next RHTE Timeframe summary: Get Timeframe
description: Get the timeframe of the next RedHat Tech Exchange description: Get the timeframe of the next RedHat Event
operationId: GetTimeframe operationId: GetTimeframe
responses: responses:
200: 200:
description: OK description: OK
/participants: /participants:
get: get:
summary: Get Next RHTE Participants summary: Get Participants
description: Get the participants of the next RedHat Tech Exchange description: Get the participants of the next RedHat Event
operationId: GetParticipants operationId: GetParticipants
responses: responses:
200: 200:

16
api-contracts/openapi-spec-v2.0.yaml

@ -1,30 +1,30 @@
--- ---
swagger: '2.0' swagger: '2.0'
info: info:
title: RHTE API with OpenID Connect title: Red Hat Event API
description: RHTE API v2.0 - An API that gives information about the Red Hat Tech Exchange description: RHTE API v2.0 - An API that gives information about the Red Hat Event
version: 2.0.0 version: 2.0.0
paths: paths:
/location: /location:
get: get:
summary: Get Next RHTE Location summary: Get Location
description: Get the location of the next RedHat Tech Exchange description: Get the location of the next RedHat Event
operationId: GetLocation operationId: GetLocation
responses: responses:
200: 200:
description: OK description: OK
/timeframe: /timeframe:
get: get:
summary: Get Next RHTE Timeframe summary: Get Timeframe
description: Get the timeframe of the next RedHat Tech Exchange description: Get the timeframe of the next RedHat Event
operationId: GetTimeframe operationId: GetTimeframe
responses: responses:
200: 200:
description: OK description: OK
/participants: /participants:
get: get:
summary: Get Next RHTE Participants summary: Get Participants
description: Get the participants of the next RedHat Tech Exchange description: Get the participants of the next RedHat Event
operationId: GetParticipants operationId: GetParticipants
responses: responses:
200: 200:

40
openapi-spec.yaml

@ -1,43 +1,31 @@
--- ---
swagger: "2.0" swagger: '2.0'
info: info:
title: RHTE API with OpenID Connect title: Red Hat Event API
description: RHTE API v2.0 - An API that gives information about the Red Hat Tech description: Red Hat Event API v1.0 - An API that gives information about the Red Hat Event
Exchange version: 1.0.0
version: 2.0.0
paths: paths:
/location: /location:
get: get:
summary: Get Next RHTE Location summary: Get Location
description: Get the location of the next RedHat Tech Exchange description: Get the location of the next RedHat Event
operationId: GetLocation operationId: GetLocation
responses: responses:
200: 200:
description: OK description: OK
/timeframe: /timeframe:
get: get:
summary: Get Next RHTE Timeframe summary: Get Timeframe
description: Get the timeframe of the next RedHat Tech Exchange description: Get the timeframe of the next RedHat Event
operationId: GetTimeframe operationId: GetTimeframe
responses: responses:
200: 200:
description: OK 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: securityDefinitions:
oidc: apikey:
type: oauth2 type: apiKey
flow: accessCode description: Use a 3scale API Key
authorizationUrl: https://filled-later.dummy/auth name: api-key
tokenUrl: https://filled-later.dummy/token in: header
scopes:
openid: Get an OpenID Connect token
security: security:
- oidc: - apikey: []
- openid

2
pipeline-template.yaml

@ -105,7 +105,7 @@ parameters:
value: http://microcks:8080/api value: http://microcks:8080/api
required: true required: true
- name: MICROCKS_SERVICE_ID - name: MICROCKS_SERVICE_ID
value: RHTE-API:1.1 value: RedHat-Event-API:1.1
required: true required: true
- name: MICROCKS_TEST_ENDPOINT - name: MICROCKS_TEST_ENDPOINT
required: true required: true

36
postman_collection.json

@ -1,8 +1,8 @@
{ {
"info": { "info": {
"_postman_id": "eebbf7c9-f616-4e1e-9128-8f26dec53958", "_postman_id": "eebbf7c9-f616-4e1e-9128-8f26dec53958",
"name": "RHTE-API", "name": "RedHat-Event-API",
"description": "version=1.1 - An API that gives information about the Red Hat Tech Exchange", "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" "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
}, },
"item": [ "item": [
@ -11,7 +11,7 @@
"description": "Folder for location", "description": "Folder for location",
"item": [ "item": [
{ {
"name": "Get Next Location", "name": "Get Location",
"event": [ "event": [
{ {
"listen": "test", "listen": "test",
@ -19,9 +19,9 @@
"id": "285eeaa2-342e-4136-b58a-ee7992196d8a", "id": "285eeaa2-342e-4136-b58a-ee7992196d8a",
"type": "text/javascript", "type": "text/javascript",
"exec": [ "exec": [
"pm.test(\"Location is Praha\", function () {", "pm.test(\"Location is on-line\", function () {",
" var jsonData = pm.response.json();", " 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": [], "header": [],
"body": {}, "body": {},
"url": "http://{{hostname}}/location", "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": [ "response": [
{ {
"id": "5fd53940-1fda-49cf-a07a-eba6c91f472d", "id": "5fd53940-1fda-49cf-a07a-eba6c91f472d",
"name": "Get Next Location", "name": "Get Location",
"originalRequest": { "originalRequest": {
"method": "GET", "method": "GET",
"header": [], "header": [],
@ -57,7 +57,7 @@
} }
], ],
"cookie": [], "cookie": [],
"body": "{ \n \"Location\": \"La Defense\"\n}\n" "body": "{ \n \"Location\": \"on-line\"\n}\n"
} }
] ]
} }
@ -68,7 +68,7 @@
"description": "Folder for timeframe", "description": "Folder for timeframe",
"item": [ "item": [
{ {
"name": "Get Next Timeframe", "name": "Get Timeframe",
"event": [ "event": [
{ {
"listen": "test", "listen": "test",
@ -78,8 +78,8 @@
"exec": [ "exec": [
"pm.test(\"Has a From and a To\", function () {", "pm.test(\"Has a From and a To\", function () {",
" var jsonData = pm.response.json();", " var jsonData = pm.response.json();",
" pm.expect(jsonData.From).to.eql(\"10/10/2018\");", " pm.expect(jsonData.From).to.eql(\"13/11/2018\");",
" pm.expect(jsonData.To).to.eql(\"10/10/2018\");", " pm.expect(jsonData.To).to.eql(\"13/11/2018\");",
"});" "});"
] ]
} }
@ -90,12 +90,12 @@
"header": [], "header": [],
"body": {}, "body": {},
"url": "http://{{hostname}}/timeframe", "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": [ "response": [
{ {
"id": "9c01b8c2-5850-4cae-8795-63ac61a83fb6", "id": "9c01b8c2-5850-4cae-8795-63ac61a83fb6",
"name": "Get Next Timeframe", "name": "Get Timeframe",
"originalRequest": { "originalRequest": {
"method": "GET", "method": "GET",
"header": [], "header": [],
@ -115,7 +115,7 @@
} }
], ],
"cookie": [], "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", "description": "Folder for participants",
"item": [ "item": [
{ {
"name": "Get Next Participants", "name": "Get Participants",
"event": [ "event": [
{ {
"listen": "test", "listen": "test",
@ -147,12 +147,12 @@
"header": [], "header": [],
"body": {}, "body": {},
"url": "http://{{hostname}}/participants", "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": [ "response": [
{ {
"id": "077baf3d-14f9-4f79-9b18-d4e0c14dcad1", "id": "077baf3d-14f9-4f79-9b18-d4e0c14dcad1",
"name": "Get Next Participants", "name": "Get Participants",
"originalRequest": { "originalRequest": {
"method": "GET", "method": "GET",
"header": [], "header": [],
@ -172,7 +172,7 @@
} }
], ],
"cookie": [], "cookie": [],
"body": "[ \n \"Sebastien\",\n \"Nicolas\"\n]" "body": "[ \n \"Nicolas\",\n \"Manfred\"\n]"
} }
] ]
} }

6
server.js

@ -9,21 +9,21 @@ router.use(function (req, res, next) {
}); });
router.get("/location", function(req, res) { router.get("/location", function(req, res) {
var response = { "Location": "La Defense" }; var response = { "Location": "on-line" };
res.type('application/json') res.type('application/json')
.send(JSON.stringify(response)) .send(JSON.stringify(response))
.end(); .end();
}); });
router.get("/timeframe",function(req, res) { 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') res.type('application/json')
.send(JSON.stringify(response)) .send(JSON.stringify(response))
.end(); .end();
}); });
router.get("/participants",function(req, res) { router.get("/participants",function(req, res) {
var response = [ "Sebastien", "Nicolas" ]; var response = [ "Nicolas", "Manfred" ];
res.type('application/json') res.type('application/json')
.send(JSON.stringify(response)) .send(JSON.stringify(response))
.end(); .end();

Loading…
Cancel
Save