Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Mar 19, 2023
1 parent 1a0c721 commit ce86e45
Show file tree
Hide file tree
Showing 26 changed files with 86 additions and 47 deletions.
3 changes: 2 additions & 1 deletion demo-mkdocs/docs/demo/openapi-v3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Support using local OpenAPI Specification file on website.
## Markdown

```html
<swagger-ui src="./openapi-spec/sample.yaml"/>
<swagger-ui src="./openapi-spec/v3.1/non-oauth-scopes.yaml"/>
<swagger-ui src="./openapi-spec/v3.1/webhook-example.yaml"/>
```

## Swagger UI
Expand Down
1 change: 1 addition & 0 deletions demo-mkdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ A MkDocs plugin supports for add [Swagger UI](https://github.com/swagger-api/swa
| supportedSubmitMethods | Array | Default: All Http Methods. Array=["get", "put", "post", "delete", "options", "head", "patch", "trace"]. List of HTTP methods that have the "Try it out" feature enabled. An empty array disables "Try it out" for all operations. This does not filter the operations from the display. |
| validatorUrl | String | Default: "none". By default, the validation is disabled. When setting with "https://validator.swagger.io/validator", Swagger UI attempts to validate specs against swagger.io's online validator in multiple OAS Swagger UI. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). |
| extra_css | Array | Default: []. Extra CSS files in your `docs_dir` included in Swagger UI iframe target html file. |
| dark_scheme_name | String | Default: "slate". Custom dark mode scheme name for [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). Check more details on [Material for MkDocs Documents](https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/). |
## How it works
Expand Down
8 changes: 5 additions & 3 deletions docs/demo/build-in-multiple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-11" id="__codelineno-0-11" name="__codelineno-0-11"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/sample.yaml"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="multiple-oas-in-single-swagger-ui">Multiple OAS in single Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="6c9c6150" src="swagger-6c9c6150.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="a55c422e" src="swagger-a55c422e.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
</p>
<h2 id="other-independent-swagger-ui">Other independent Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="332aed19" src="swagger-332aed19.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="e7949c7b" src="swagger-e7949c7b.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -434,6 +434,8 @@ <h2 id="other-independent-swagger-ui">Other independent Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -446,7 +448,7 @@ <h2 id="other-independent-swagger-ui">Other independent Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -79,7 +80,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("6c9c6150");
parent.update_swagger_ui_iframe_height("a55c422e");
});

// start observing for resizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("332aed19");
parent.update_swagger_ui_iframe_height("e7949c7b");
});

// start observing for resizing
Expand Down
10 changes: 6 additions & 4 deletions docs/demo/multiple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-3" id="__codelineno-0-3" name="__codelineno-0-3"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"https://petstore.swagger.io/v2/swagger.json"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="609999a2" src="swagger-609999a2.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="dd212d42" src="swagger-dd212d42.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="a70d04b1" src="swagger-a70d04b1.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="445eaa78" src="swagger-445eaa78.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="ffa08031" src="swagger-ffa08031.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="b0e80296" src="swagger-b0e80296.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -410,6 +410,8 @@ <h2 id="swagger-ui">Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -422,7 +424,7 @@ <h2 id="swagger-ui">Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("71d9bf85");
parent.update_swagger_ui_iframe_height("445eaa78");
});

// start observing for resizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("fa13c87f");
parent.update_swagger_ui_iframe_height("b0e80296");
});

// start observing for resizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("dd212d42");
parent.update_swagger_ui_iframe_height("ffa08031");
});

// start observing for resizing
Expand Down
6 changes: 4 additions & 2 deletions docs/demo/oauth2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-9" id="__codelineno-0-9" name="__codelineno-0-9"></a> <span class="na">usePkceWithAuthorizationCodeGrant</span><span class="o">=</span><span class="s">"false"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="b3cf5a8c" src="swagger-b3cf5a8c.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="1a7881f7" src="swagger-1a7881f7.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -456,6 +456,8 @@ <h2 id="swagger-ui">Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -468,7 +470,7 @@ <h2 id="swagger-ui">Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -68,7 +69,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("b3cf5a8c");
parent.update_swagger_ui_iframe_height("1a7881f7");
});

// start observing for resizing
Expand Down
11 changes: 7 additions & 4 deletions docs/demo/openapi-v3.1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,12 @@
<h1>OpenAPI v3.1</h1>
<p>Support using local OpenAPI Specification file on website.</p>
<h2 id="markdown">Markdown</h2>
<div class="highlight"><pre><span></span><code><a href="#__codelineno-0-1" id="__codelineno-0-1" name="__codelineno-0-1"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/sample.yaml"</span><span class="p">/&gt;</span>
<div class="highlight"><pre><span></span><code><a href="#__codelineno-0-1" id="__codelineno-0-1" name="__codelineno-0-1"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/v3.1/non-oauth-scopes.yaml"</span><span class="p">/&gt;</span>
<a href="#__codelineno-0-2" id="__codelineno-0-2" name="__codelineno-0-2"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/v3.1/webhook-example.yaml"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="6df0856a" src="swagger-6df0856a.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="a329f7b2" src="swagger-a329f7b2.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="5af469f8" src="swagger-5af469f8.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="beb9eba0" src="swagger-beb9eba0.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -406,6 +407,8 @@ <h2 id="swagger-ui">Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -418,7 +421,7 @@ <h2 id="swagger-ui">Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("6df0856a");
parent.update_swagger_ui_iframe_height("5af469f8");
});

// start observing for resizing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("a329f7b2");
parent.update_swagger_ui_iframe_height("beb9eba0");
});

// start observing for resizing
Expand Down
6 changes: 4 additions & 2 deletions docs/demo/pet-store-full-width/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-7" id="__codelineno-0-7" name="__codelineno-0-7"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"https://petstore.swagger.io/v2/swagger.json"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="fa13c87f" src="swagger-fa13c87f.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="d50a8796" src="swagger-d50a8796.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -412,6 +412,8 @@ <h2 id="swagger-ui">Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -424,7 +426,7 @@ <h2 id="swagger-ui">Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("a70d04b1");
parent.update_swagger_ui_iframe_height("d50a8796");
});

// start observing for resizing
Expand Down
6 changes: 4 additions & 2 deletions docs/demo/static-file/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ <h2 id="markdown">Markdown</h2>
<div class="highlight"><pre><span></span><code><a href="#__codelineno-0-1" id="__codelineno-0-1" name="__codelineno-0-1"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/sample.yaml"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="71d9bf85" src="swagger-71d9bf85.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="9306bdb2" src="swagger-9306bdb2.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
Expand Down Expand Up @@ -406,6 +406,8 @@ <h2 id="swagger-ui">Swagger UI</h2>
}
});

const dark_scheme_name = "slate"

window.scheme = document.body.getAttribute("data-md-color-scheme")
const options = {
attributeFilter: ['data-md-color-scheme'],
Expand All @@ -418,7 +420,7 @@ <h2 id="swagger-ui">Swagger UI</h2>
for(var i = 0; i < iframe_list.length; i++) {
var ele = iframe_list.item(i);
if (ele) {
if (scheme === "slate") {
if (scheme === dark_scheme_name) {
ele.contentWindow.enable_dark_mode();
} else {
ele.contentWindow.disable_dark_mode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
],
"validatorUrl": "none",
"extra_css": [],
"dark_scheme_name": "slate",
"syntaxHighlight.theme": "agate"

})
Expand All @@ -66,7 +67,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("609999a2");
parent.update_swagger_ui_iframe_height("9306bdb2");
});

// start observing for resizing
Expand Down
Loading

0 comments on commit ce86e45

Please sign in to comment.