generated from codegouvfr/eleventy-dsfr
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ajout composant swagger-ui #21
Co-authored-by: pprevautel <philippe.prevautel@ign.fr>
- Loading branch information
Showing
7 changed files
with
1,647 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div id="{{ params.targetId }}" class="frx-swagger-ui"></div> | ||
<script> | ||
window.addEventListener('load', function() { | ||
SwaggerUIBundle({ | ||
url: "{{ params.url }}", | ||
dom_id: "{{ '#' ~ params.targetId }}", | ||
docExpansion: "{{ (params.docExpansion|default('none')) }}" | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: Intégration du Swagger UI | ||
description: Comment intégrer le Swagger UI dans une page du site ? | ||
date: git Last Modified | ||
swaggerui: true | ||
tags: | ||
- composant | ||
--- | ||
|
||
Chaque composant peut être inclus dans un fichier Nunjucks `.njk` ou Markdown `.md`. | ||
|
||
## Exemple d'utilisation | ||
|
||
```njk | ||
{% raw %} | ||
{% from "components/component.njk" import component with context %} | ||
{{ component("swaggerui", { | ||
url: "https://data-qua.priv.geopf.fr/api/v3/api-docs", | ||
targetId: "swagger-ui-demo" | ||
}) }} | ||
{% endraw %} | ||
``` | ||
|
||
Le format complet de l'objet en paramètre est le suivant : | ||
|
||
```json | ||
{ | ||
"url": "string", | ||
"targetId": "string", | ||
"docExpansion": "full|list|none*" | ||
} | ||
``` | ||
|
||
## Rendu | ||
|
||
{% from "components/component.njk" import component with context %} | ||
{{ component("swaggerui", { | ||
url: "https://data-qua.priv.geopf.fr/api/v3/api-docs", | ||
targetId: "swagger-ui-demo" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters