Commit cc82a1e4 authored by Daniel Perez's avatar Daniel Perez
Browse files

Merge branch 'slb/dperez50/fix-swagger' into 'master'

Slb/dperez50/fix swagger

See merge request !64
parents 869c04db 51c12b91
Pipeline #36144 failed with stages
in 10 minutes and 28 seconds
......@@ -8286,20 +8286,15 @@
}
},
"replace-in-file": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-6.1.0.tgz",
"integrity": "sha512-URzjyF3nucvejuY13HFd7O+Q6tFJRLKGHLYVvSh+LiZj3gFXzSYGnIkQflnJJulCAI2/RTZaZkpOtdVdW0EhQA==",
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-6.2.0.tgz",
"integrity": "sha512-Im2AF9G/qgkYneOc9QwWwUS/efyyonTUBvzXS2VXuxPawE5yQIjT/e6x4CTijO0Quq48lfAujuo+S89RR2TP2Q==",
"requires": {
"chalk": "^4.0.0",
"chalk": "^4.1.0",
"glob": "^7.1.6",
"yargs": "^15.3.1"
"yargs": "^16.2.0"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
......@@ -8312,47 +8307,6 @@
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"string-width": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"requires": {
"ansi-regex": "^5.0.0"
}
},
"yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"requires": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.2"
}
}
}
},
......
......@@ -27,6 +27,7 @@ import https from 'https';
import swaggerUi from 'swagger-ui-express';
import YAML from 'yamljs';
import replaceInFile from 'replace-in-file';
// -------------------------------------------------------------------
// Seismic Store Service
......@@ -69,8 +70,27 @@ export class Server {
]
}
private options_div_clear = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{display:none;visibility:hidden',
to: '.swagger-ui .topbar{'
}
private options_div_hide = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{',
to: '.swagger-ui .topbar{display:none;visibility:hidden;'
}
constructor() {
const swaggerDocument = YAML.load('./dist/docs/api/openapi.osdu.yaml');
try {
replaceInFile.sync(this.options_div_clear);
replaceInFile.sync(this.options_div_hide);
}
catch (error) {
console.error('Error occurred:', error);
}
this.app = express();
this.app.use(bodyparser.urlencoded({ extended: false }));
......@@ -80,7 +100,7 @@ export class Server {
this.app.options('*', cors());
this.app.use('/seistore-svc/api/v3/swagger-ui.html',swaggerUi.serve, swaggerUi.setup(swaggerDocument,{
customCss: '.swagger-ui .topbar { display: none }'
}));
}));
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
// not required anymore - to verify
......
Supports Markdown
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