Skip to content

Commit 96b1554

Browse files
committed
Merge branch 'olexandr-klymenko-master'
2 parents ea2dd2e + d81cd45 commit 96b1554

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

aiohttp_swagger/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def setup_swagger(app: web.Application,
4040
swagger_from_file: str = None,
4141
swagger_url: str = "/api/doc",
4242
api_base_url: str = "/",
43+
swagger_validator_url: str = "",
4344
description: str = "Swagger API definition",
4445
api_version: str = "1.0.0",
4546
title: str = "Swagger API",
@@ -99,6 +100,7 @@ def setup_swagger(app: web.Application,
99100
format(api_base_url.rstrip('/'), _swagger_def_url))
100101
.replace("##STATIC_PATH##", '{}{}'.
101102
format(api_base_url.rstrip('/'), statics_path))
103+
.replace("##SWAGGER_VALIDATOR_URL##", swagger_validator_url)
102104
)
103105

104106

aiohttp_swagger/swagger_ui/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
}
5151
window.swaggerUi = new SwaggerUi({
5252
url: url,
53+
validatorUrl: "##SWAGGER_VALIDATOR_URL##" || null,
5354
dom_id: "swagger-ui-container",
5455
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
5556
onComplete: function(swaggerApi, swaggerUi){

doc/source/customizing.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,17 @@ In this case `api_base_url` argument of `setup_swagger` function should be the s
255255
256256
app.add_subapp(prefix='/sub_app_prefix', subapp=sub_app)
257257
258-
web.run_app(app, host="127.0.0.1")
258+
web.run_app(app, host="127.0.0.1")
259+
260+
Swagger validation
261+
+++++++++++++++++++
262+
263+
:samp:`aiohttp-swagger` allows to perform online swagger validation. By default this feature is turned off `(swagger_validator_url='')`:
264+
265+
266+
.. code-block:: python
267+
268+
setup_swagger(app,
269+
api_base_url='/sub_app_prefix',
270+
swagger_validator_url='//online.swagger.io/validator'
271+
)

0 commit comments

Comments
 (0)