Browse Source

Update ReDoc to version 2.0.0

FastAPI has for the past 4 years been using the the `next` version of ReDoc (development version of 2.0.0). The official 2.0.0 version was however released around 9 months ago and the `next` tag still points to `2.0.0-rc.75`. I thought it would be a good idea to update to the final version now rather than the old release candidate.

I also noticed that the examples in the documentation shows what the file used to look like, but the license information has been moved to a separate file and there's just a pointer to that nowadays. I updated the example with what users can today expect to find there now.

It's of course a bit of a question if the version should be locked to 2.0.0 or if the `latest` tag should instead be used. Please let me know if you'd rather have me switch to that tag.
pull/9700/head
Joakim Nordling 2 years ago
parent
commit
5c3537bb30
  1. 12
      docs/em/docs/advanced/extending-openapi.md
  2. 12
      docs/en/docs/advanced/extending-openapi.md
  3. 2
      fastapi/openapi/docs.py
  4. 2
      tests/test_application.py

12
docs/em/docs/advanced/extending-openapi.md

@ -137,7 +137,7 @@
& **📄** ⚙️ 📁:
* <a href="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
* <a href="https://cdn.jsdelivr.net/npm/redoc@2.0.0/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
⏮️ 👈, 👆 📁 📊 💪 👀 💖:
@ -170,14 +170,8 @@
⚫️ 💪 ▶️ ⏮️ 🕳 💖:
```JavaScript
/*!
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
* -------------------------------------------------------------
* Version: "2.0.0-rc.18"
* Repo: https://github.com/Redocly/redoc
*/
!function(e,t){"object"==typeof exports&&"object"==typeof m
/*! For license information please see redoc.standalone.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
...
```

12
docs/en/docs/advanced/extending-openapi.md

@ -137,7 +137,7 @@ You can probably right-click each link and select an option similar to `Save lin
And **ReDoc** uses the file:
* <a href="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
* <a href="https://cdn.jsdelivr.net/npm/redoc@2.0.0/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
After that, your file structure could look like:
@ -170,14 +170,8 @@ You should see a very long JavaScript file for **ReDoc**.
It could start with something like:
```JavaScript
/*!
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
* -------------------------------------------------------------
* Version: "2.0.0-rc.18"
* Repo: https://github.com/Redocly/redoc
*/
!function(e,t){"object"==typeof exports&&"object"==typeof m
/*! For license information please see redoc.standalone.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
...
```

2
fastapi/openapi/docs.py

@ -76,7 +76,7 @@ def get_redoc_html(
*,
openapi_url: str,
title: str,
redoc_js_url: str = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js",
redoc_js_url: str = "https://cdn.jsdelivr.net/npm/redoc@2.0.0/bundles/redoc.standalone.js",
redoc_favicon_url: str = "https://fastapi.tiangolo.com/img/favicon.png",
with_google_fonts: bool = True,
) -> HTMLResponse:

2
tests/test_application.py

@ -42,7 +42,7 @@ def test_redoc():
response = client.get("/redoc")
assert response.status_code == 200, response.text
assert response.headers["content-type"] == "text/html; charset=utf-8"
assert "redoc@next" in response.text
assert "redoc@2.0.0" in response.text
def test_enum_status_code_response():

Loading…
Cancel
Save