Skip to content

Commit b51e452

Browse files
authored
Merge pull request #36 from y-marion/issue-35-relative-url-fix
Upgrade swagger-ui assets to v5.27.1
2 parents 7be4ca4 + 49b0708 commit b51e452

File tree

9 files changed

+46
-18
lines changed

9 files changed

+46
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.vscode/
33
playwright-results/
44
docs/
5+
node_modules/
56

67
# Byte-compiled / optimized / DLL files
78
__pycache__/

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ A MkDocs plugin supports adding [Swagger UI](https://github.com/swagger-api/swag
2525
1. Python Package
2626
1. beautifulsoup4>=4.13.3
2727
2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and CSS file
28-
1. swagger-ui-dist==5.21.0
28+
1. swagger-ui-dist==5.27.1
2929

3030
## Usage
3131

@@ -80,9 +80,17 @@ filter_files
8080
8181
## How it works
8282
83-
1. Copy the Swagger UI script file into `site/assets/javascripts/` directory, the CSS file into `site/assets/stylesheets/` directory, and the [default Oauth2 redirect html](https://github.com/blueswen/mkdocs-swagger-ui-tag/blob/main/mkdocs_swagger_ui_tag/swagger-ui/oauth2-redirect.html) into `site/assets/swagger-ui/` directory
83+
1. Copies the Swagger UI script file into `site/assets/javascripts/` directory, the CSS file into `site/assets/stylesheets/` directory, and the [default Oauth2 redirect html](https://github.com/blueswen/mkdocs-swagger-ui-tag/blob/main/mkdocs_swagger_ui_tag/swagger-ui/oauth2-redirect.html) into `site/assets/swagger-ui/` directory
8484
2. Search all swagger-ui tags, then convert them to an iframe tag and generate the iframe target HTML with the given OpenAPI Specification src path and options
8585
86+
## Development
87+
88+
### Upgrading the Swagger-UI version
89+
90+
To upgrade the version of `swagger-ui-dist` update the version in the [package.json](./package.json) and install with `npm i`.
91+
92+
After this, run the provided [update swagger ui script](./update-swagger-ui.sh) to move the files to the appropriate folders and commit the changes.
93+
8694
## License
8795
8896
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Blueswen/mkdocs-swagger-ui-tag/blob/main/LICENSE) file for details.

mkdocs_swagger_ui_tag/swagger-ui/javascripts/swagger-ui-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mkdocs_swagger_ui_tag/swagger-ui/stylesheets/swagger-ui.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mkdocs_swagger_ui_tag/swagger-ui/stylesheets/swagger-ui.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"swagger-ui-dist": "5.21.0"
3+
"swagger-ui-dist": "5.27.1"
44
}
55
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "mkdocs-swagger-ui-tag"
7-
version = "0.7.1"
7+
version = "0.7.2"
88
description = "A MkDocs plugin supports for add Swagger UI in page."
99
readme = "README.md"
1010
license = "MIT"

update-swagger-ui.sh

100644100755
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
if [ -z "$1" ]
2-
then
3-
echo "No version supplied"
4-
exit 1
5-
fi
6-
7-
VER="$1"
81
DEST="./mkdocs_swagger_ui_tag/swagger-ui"
9-
SOURCE="https://raw.githubusercontent.com/swagger-api/swagger-ui/$1/dist"
2+
SOURCE="./node_modules/swagger-ui-dist"
103
JS_LIST="swagger-ui-bundle.js.map swagger-ui-standalone-preset.js.map swagger-ui-bundle.js swagger-ui-standalone-preset.js"
114
CSS_LIST="swagger-ui.css swagger-ui.css.map"
125
HTML_LIST="oauth2-redirect.html"
136

147
for f in $JS_LIST; do
15-
wget ${SOURCE}/${f} -O ${DEST}/javascripts/${f}
8+
cp ${SOURCE}/${f} ${DEST}/javascripts/${f}
169
done
1710

1811
for f in $CSS_LIST; do
19-
wget ${SOURCE}/${f} -O ${DEST}/stylesheets/${f}
12+
cp ${SOURCE}/${f} ${DEST}/stylesheets/${f}
2013
done
2114

2215
for f in $HTML_LIST; do
23-
wget ${SOURCE}/${f} -O ${DEST}/${f}
16+
cp ${SOURCE}/${f} ${DEST}/${f}
2417
done

0 commit comments

Comments
 (0)