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'
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:

16
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:

16
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:

40
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: []

2
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

36
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]"
}
]
}

6
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();

Loading…
Cancel
Save