Commit 657a3558 authored by Daniel Perez's avatar Daniel Perez
Browse files

Adding first config for swagger

parent 79a6d3d4
Pipeline #33669 passed with stages
in 5 minutes and 12 seconds
......@@ -8704,6 +8704,19 @@
"has-flag": "^1.0.0"
}
},
"swagger-ui-dist": {
"version": "3.45.1",
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.45.1.tgz",
"integrity": "sha512-QWotWWYkgSdPtI6HW12q4Ua5zxIhhvnYvx9iZKtDbZuVvJSTnMIzaHrE6KJVe/8plWh7Wpd/qqeBfpOxF8g1/g=="
},
"swagger-ui-express": {
"version": "4.1.6",
"resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.1.6.tgz",
"integrity": "sha512-Xs2BGGudvDBtL7RXcYtNvHsFtP1DBFPMJFRxHe5ez/VG/rzVOEjazJOOSc/kSCyxreCTKfJrII6MJlL9a6t8vw==",
"requires": {
"swagger-ui-dist": "^3.18.1"
}
},
"symbol": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/symbol/-/symbol-0.3.1.tgz",
......
......@@ -25,6 +25,9 @@ import { Feature, FeatureFlags } from '../shared';
import fs from 'fs';
import https from 'https';
import swaggerUi from 'swagger-ui-express';
import * as swaggerDocument from '../swagger/swagger.json';
// -------------------------------------------------------------------
// Seismic Store Service
// -------------------------------------------------------------------
......@@ -73,6 +76,7 @@ export class Server {
this.app.disable('x-powered-by');
this.app.use(cors(this.corsOptions));
this.app.options('*', cors());
this.app.use('/seistore-svc/api/v3/swagger-ui.html', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
// not required anymore - to verify
......
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Api Documentation",
"description": "Api Documentation",
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"securityDefinitions": {
"authentication": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"paths": {
"/seistore-svc/api/v3/svcstatus": {
"get": {
"tags": [
"General"
],
"description": "Verify access",
"parameters": [
{
"name": "x-api-key",
"in": "header",
"required": false
},
{
"name": "appkey",
"in": "header",
"required": false
}
],
"produces": [
"text/plain"
],
"responses": {
"200": {
"description": "Service running"
},
"404": {
"description": "Service not running"
}
}
}
},
"/seistore-svc/api/v3/svcstatus/access": {
"get": {
"tags": [
"General"
],
"description": "Verify authorization",
"security":[
{
"authentication": []
}
],
"parameters": [
{
"name": "x-api-key",
"in": "header",
"required": false
},
{
"name": "appkey",
"in": "header",
"required": false
}
],
"produces": [
"text/plain"
],
"responses": {
"200": {
"description": "Authorization working fine"
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/seistore-svc/api/v3/tenant/{tenant}": {
"get": {
"tags": [
"Tenant"
],
"description": "Get tenant",
"security":[
{
"authentication": []
}
],
"parameters": [
{
"name": "tenant",
"in": "path",
"required": true
},
{
"name": "x-api-key",
"in": "header",
"required": false
},
{
"name": "appkey",
"in": "header",
"required": false
}
],
"produces": [
"text/plain"
],
"responses": {
"200": {
"description": "Tenat returned"
},
"401": {
"description": "Unauthorized"
}
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment