-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use redoc to make OpenAPI file available on the site
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
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,9 @@ | ||
class OpenAPIController < ApplicationController | ||
include Authentication | ||
|
||
allow_unauthenticated_access | ||
|
||
layout 'application' | ||
|
||
def show; end | ||
end |
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,29 @@ | ||
<div id="redoc_container"> | ||
</div> | ||
|
||
<script> | ||
function initRedoc() { | ||
var uri = '<%= open_api_v1_path %>'; | ||
|
||
Redoc.init( | ||
uri, | ||
{ | ||
jsonSampleExpandLevel: 'all', | ||
expandResponses: '200', | ||
expandSingleSchemaField: true, | ||
schemaExpansionLevel: 'all' | ||
}, | ||
document.getElementById('redoc_container') | ||
) | ||
} | ||
|
||
var redocScript = document.createElement("script"); | ||
|
||
redocScript.src = "https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"; | ||
|
||
redocScript.onload = function () { | ||
initRedoc(); | ||
}; | ||
|
||
document.documentElement.firstChild.appendChild(redocScript); | ||
</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,9 @@ | ||
# language: fr | ||
|
||
Fonctionnalité: Développeurs: consultation de la documentation | ||
@javascript | ||
|
||
Scénario: Je peux voir la documentation OpenAPI de manière jolie | ||
Quand je me rends sur le chemin "/developpeurs/documentation" | ||
Alors la page contient "API DataPass" | ||
|
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