Skip to content

Commit

Permalink
Update swagger-ui-dist to 5.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Jan 22, 2024
1 parent e3d2493 commit 175035a
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
mkdocs-swagger-ui-tag 0.6.8 (2024-01-22)

* Updated swagger-ui-dist to 5.11.0

mkdocs-swagger-ui-tag 0.6.7 (2023-11-18)

* Updated swagger-ui-dist to 5.10.0
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@
<a target="_blank" href="https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag"><img src="https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag/branch/main/graph/badge.svg?token=1D1B0GAQN1" alt="Codecov"/></a>
</p>

A MkDocs plugin supports for add [Swagger UI](https://github.com/swagger-api/swagger-ui) in page.
A MkDocs plugin supports adding [Swagger UI](https://github.com/swagger-api/swagger-ui) to the page.

[Live demo](https://blueswen.github.io/mkdocs-swagger-ui-tag/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).

## Features

1. OpenAPI Specification file from online over URL or static file in docs
2. All dependencies are using static files handled by plugin not from CDN, especially suitable for those documents been deployed in the intranet
3. Multiple Swagger UI in same page
2. All dependencies are using static files handled by the plugin not from CDN, especially suitable for those documents been deployed in the intranet
3. Multiple Swagger UI on the same page
4. Synchronized dark mode with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)
5. Configure [Swagger UI configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/) through plugin options and tag attributes
6. Support multiple OAS in single Swagger UI with top bar selector
6. Support multiple OAS in a single Swagger UI with a top bar selector
7. Support Swagger UI [initOAuth](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/) method

## Dependency

1. Python Package
1. beautifulsoup4>=4.11.1
2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and css file
1. swagger-ui-dist==5.10.0
2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and CSS file
1. swagger-ui-dist==5.11.0

## Usage

1. Install plugin from pypi
1. Install the plugin from PyPI

```bash
pip install mkdocs-swagger-ui-tag
```

2. Add ```swagger-ui-tag``` plugin in to your mkdocs.yml plugins sections:
2. Add ```swagger-ui-tag``` plugin to your mkdocs.yml plugins sections:

```yaml
plugins:
Expand Down Expand Up @@ -75,8 +75,8 @@ A MkDocs plugin supports for add [Swagger UI](https://github.com/swagger-api/swa
## How it works
1. Copy Swagger UI script file into `site/assets/javascripts/` directory, 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
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
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
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
## License
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"swagger-ui-dist": "5.9.1"
"swagger-ui-dist": "5.11.0"
}
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="mkdocs-swagger-ui-tag",
version="0.6.7",
version="0.6.8",
author="Blueswen",
author_email="[email protected]",
url="https://blueswen.github.io/mkdocs-swagger-ui-tag",
Expand Down
39 changes: 3 additions & 36 deletions tests/test_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import re
import shutil

# MkDocs
from mkdocs.__main__ import build_command

# other 3rd party
from bs4 import BeautifulSoup
from click.testing import CliRunner

# MkDocs
from mkdocs.__main__ import build_command

# ##################################
# ######## Globals #################
# ##################################
Expand Down Expand Up @@ -116,39 +116,6 @@ def validate_mkdocs_file(
return testproject_path


def validate_static(html_content: str, path: str = "", exist: bool = True):
"""
Validate glightbox.min.css and glightbox.min.js have been loaded or not
"""
assert exist == (
re.search(
rf'<link href="{path}assets\/stylesheets\/glightbox\.min\.css" rel="stylesheet"\/>',
html_content,
)
is not None
)
assert exist == (
re.search(
rf'<script src="{path}assets\/javascripts\/glightbox\.min\.js"><\/script>',
html_content,
)
is not None
)


def validate_script(html_content: str, exist: bool = True):
"""
Validate GLightbox have been initialized or not
"""
assert exist == (
re.search(
r"const lightbox = GLightbox\((.*)\);",
html_content,
)
is not None
)


def validate_iframe(html_content, iframe_src_dir):
"""
Validate target iframe html exist
Expand Down

0 comments on commit 175035a

Please sign in to comment.