forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[website]Support multi version for swagger (apache#5032)
* Support multi version for admin rest api * Support multi for functions, source and sinks rest api * Default version is master * generate swagger file for multi version * Generate swagger json for multi api * Add comment for copy file * Generate swagger file only to master
- Loading branch information
Showing
7 changed files
with
45 additions
and
17 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
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
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
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,24 @@ | ||
function getSwaggerByVersion(){ | ||
var params = window.location.search | ||
params = params.replace('?', '') | ||
const paramsList = params.split('&') | ||
var version = 'master' | ||
for (var i in paramsList) { | ||
var param = paramsList[i].split('=') | ||
if (param[0] === 'version') { | ||
version = param[1] | ||
} | ||
} | ||
const wrapper = document.querySelector('.pageContainer .wrapper') | ||
const redoc = document.createElement('redoc'); | ||
redoc.setAttribute('spec-url', '/swagger/' + version + '/swagger.json') | ||
redoc.setAttribute('lazy-rendering', 'true') | ||
const redocLink = document.createElement('script'); | ||
redocLink.setAttribute('src', 'https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js') | ||
const script = document.querySelector('.pageContainer .wrapper script') | ||
|
||
wrapper.insertBefore(redoc, script) | ||
wrapper.insertBefore(redocLink, script) | ||
|
||
} | ||
window.onload=getSwaggerByVersion |
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