Skip to content

Commit

Permalink
Merge branch 'piccolo-orm:master' into pydantic_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sinisaos authored Aug 3, 2023
2 parents 32fb32f + 5a7ce77 commit 74dd98f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changes
=======

0.58.0
------

Upgraded the version of Swagger UI used in the ``swagger_ui`` endpoint (see
``piccolo_api.openapi.endpoints.swagger_ui``). Thanks to @sinisaos for this.

-------------------------------------------------------------------------------

0.57.0
------

Expand Down
2 changes: 1 addition & 1 deletion piccolo_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "0.57.0"
__VERSION__ = "0.58.0"
4 changes: 4 additions & 0 deletions piccolo_api/openapi/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def swagger_ui(
swagger_ui_title: str = "Piccolo Swagger UI",
csrf_cookie_name: t.Optional[str] = DEFAULT_COOKIE_NAME,
csrf_header_name: t.Optional[str] = DEFAULT_HEADER_NAME,
swagger_ui_version: str = "5",
):
"""
Even though ASGI frameworks such as FastAPI and BlackSheep have endpoints
Expand Down Expand Up @@ -53,6 +54,8 @@ def swagger_ui(
The name of the CSRF cookie.
:param csrf_header_name:
The HTTP header name which the CSRF cookie value will be added to.
:param swagger_ui_version:
Which version of Swagger UI to use.
"""

Expand All @@ -68,6 +71,7 @@ def get(self, request: Request):
swagger_ui_title=swagger_ui_title,
csrf_cookie_name=csrf_cookie_name,
csrf_header_name=csrf_header_name,
swagger_ui_version=swagger_ui_version,
)
return HTMLResponse(content=html)

Expand Down
4 changes: 2 additions & 2 deletions piccolo_api/openapi/templates/swagger_ui.html.jinja
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui.css">
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@{{ swagger_ui_version }}/swagger-ui.css">
<title>{{ swagger_ui_title }}</title>
</head>

<body>
<div id="swagger-ui">
</div>
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@4/swagger-ui-bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@{{ swagger_ui_version }}/swagger-ui-bundle.js"></script>
{% if csrf_cookie_name and csrf_header_name %}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/js.cookie.min.js"></script>
{% endif %}
Expand Down

0 comments on commit 74dd98f

Please sign in to comment.