From 243cf5a7e593e86af822554b27b1b69bd7e02af6 Mon Sep 17 00:00:00 2001 From: Fabrice Daugan Date: Fri, 23 Feb 2024 00:00:20 +0100 Subject: [PATCH] Add 'x-api-via-user' header in Swagger --- .../resources/webjars/api/home/home.css | 10 + .../resources/webjars/api/home/home.html | 192 +----------------- .../resources/webjars/api/home/home.js | 27 ++- 3 files changed, 36 insertions(+), 193 deletions(-) diff --git a/src/main/resources/META-INF/resources/webjars/api/home/home.css b/src/main/resources/META-INF/resources/webjars/api/home/home.css index e69de29..b16cf21 100644 --- a/src/main/resources/META-INF/resources/webjars/api/home/home.css +++ b/src/main/resources/META-INF/resources/webjars/api/home/home.css @@ -0,0 +1,10 @@ +.swagger-ui .topbar { + display: none; +} +.swagger-ui .schemes-server-container { + visibility: hidden; +} +.swagger-ui .version { + background-color: transparent!important; + border-color: transparent; +} \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/webjars/api/home/home.html b/src/main/resources/META-INF/resources/webjars/api/home/home.html index 3f7ea27..e431392 100644 --- a/src/main/resources/META-INF/resources/webjars/api/home/home.html +++ b/src/main/resources/META-INF/resources/webjars/api/home/home.html @@ -1,188 +1,4 @@ -
- {{wip}} -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{method}}{{path}}{{parameters}}{{result}}{{note}}
GET/api/token Nom des clés associées à l'utilisateur actuel. Pas paginé, trié par ordre alphabétique. - - - - - - - - - - - -
{{request}}{{result}}
GET /api/token["Client externe A", "Server BI Cube Z", "server1"]
GET/api/token/{name}{name} : Nom de la clé à récupérer du serveurValeur de la clé correspondant au nom demandé. - - - - - - - - - - - - - - - -
{{request}}{{result}}
GET /api/token/server1200 BWo9iEky2tpPX7RPhovNy5SywYI2fmacfRnL... (128+)
GET /api/token/not-exist404
PUT/api/token/{name}{name} : Nom de la clé à regénérerNouvelle clé associée au nom spécifié. - - - - - - - - - - - - - - - -
{{request}}{{result}}
PUT /api/token/server1200 G51xg2we70Ffd2YikudjpfvQszt63hXgjOMRqR71... (128+)
PUT /api/token/not-exist404
POST/api/token/{name}{name} : Nom de la clé à créerClé créée et associée au nom spécifié. - - - - - - - - - - - - - - - -
{{request}}{{result}}
POST /api/token/server2200 G51xg2we70Ffd2YikudjpfvQszt63hXgjOMRqR71... (128+)
POST /api/token/cle-exist400
DELETE/api/token/{name}{name} : Nom de la clé à supprimer  - - - - - - - - - - - - - - - -
{{request}}{{result}}
POST /api/token/server1200
POST /api/token/not-exist200
GET/service/bt/jira/export/sla/{souscription}/{file:.*-short.csv}{souscription} : Identifiant de la souscription.
- {file} : Nom du fichier. N'est pas vérifié, mais doit se terminer par -short.csv -
Export au format CSV (séparateur ;) de tous les tickets JIRA du projet associé sans les champs personnalisés. - - - - - - - - - - - -
{{request}}{{result}}
GET /service/bt/jira/export/sla/14781/SIOP-2015-09-20-short.csv200 (fichier CSV)
GET/service/bt/jira/export/sla/{souscription}/{file:.*.xml}{souscription} : Identifiant de la souscription.
- {file} : Nom du fichier. N'est pas vérifié, mais doit se terminer par .xml -
Export au format Excel 2003+ (xml) de tous les tickets JIRA du projet associé sans les champs personnalisés. - - - - - - - - - - - -
{{request}}{{result}}
GET /service/bt/jira/export/sla/14781/SIOP-2015-09-20.xml200 (fichier Excel)
GET/service/bt/jira/export/sla/{souscription}/{file:.*-full.csv}{souscription} : Identifiant de la souscription.
- {file} : Nom du fichier. N'est pas vérifié, mais doit se terminer par -full.csv -
Export au format CSV (séparateur ;) de tous les tickets JIRA du projet associé avec les champs personnalisés et les compteurs. - - - - - - - - - - - -
{{request}}{{result}}
GET /service/bt/jira/export/sla/14781/SIOP-2015-09-20-full.csv200 (fichier CSV)
+ + + +
diff --git a/src/main/resources/META-INF/resources/webjars/api/home/home.js b/src/main/resources/META-INF/resources/webjars/api/home/home.js index da11eea..b525e2c 100644 --- a/src/main/resources/META-INF/resources/webjars/api/home/home.js +++ b/src/main/resources/META-INF/resources/webjars/api/home/home.js @@ -1,11 +1,28 @@ /* * Licensed under MIT (https://github.com/ligoj/ligoj/blob/master/LICENSE) */ -define({ +define(["../../../rest/swagger-ui-bundle.js","../../../rest/swagger-ui-standalone-preset.js"], function(SwaggerUIBundle,SwaggerUIStandalonePreset) { + return { initialize: function () { - $('.table').dataTable({ - dom: 't', - pageLength: -1 - }); + window.SwaggerTranslator; + $(function(){ + // Build a system + const ui = SwaggerUIBundle({ + url: "rest/openapi.json", + dom_id: '#swagger-ui', + defaultModelsExpandDepth: -1, + deepLinking: false, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl + ], + layout: "StandaloneLayout" + }) + window.ui = ui + }) } + }; });