mirror of https://github.com/tiangolo/fastapi.git
⬆️ Update ReDoc to version 2.x (#9700)
Co-authored-by: svlandeg <svlandeg@github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com> Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
parent
4199172977
commit
8fa56b46a1
|
|
@ -98,7 +98,7 @@ Sie können wahrscheinlich mit der rechten Maustaste auf jeden Link klicken und
|
||||||
|
|
||||||
Und **ReDoc** verwendet diese Datei:
|
Und **ReDoc** verwendet diese Datei:
|
||||||
|
|
||||||
* <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/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
|
||||||
|
|
||||||
Danach könnte Ihre Dateistruktur wie folgt aussehen:
|
Danach könnte Ihre Dateistruktur wie folgt aussehen:
|
||||||
|
|
||||||
|
|
@ -129,14 +129,8 @@ Sie sollten eine sehr lange JavaScript-Datei für **ReDoc** sehen.
|
||||||
Sie könnte beginnen mit etwas wie:
|
Sie könnte beginnen mit etwas wie:
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
/*!
|
/*! For license information please see redoc.standalone.js.LICENSE.txt */
|
||||||
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
|
||||||
* -------------------------------------------------------------
|
|
||||||
* Version: "2.0.0-rc.18"
|
|
||||||
* Repo: https://github.com/Redocly/redoc
|
|
||||||
*/
|
|
||||||
!function(e,t){"object"==typeof exports&&"object"==typeof m
|
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ You can probably right-click each link and select an option similar to `Save lin
|
||||||
|
|
||||||
And **ReDoc** uses the file:
|
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/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
|
||||||
|
|
||||||
After that, your file structure could look like:
|
After that, your file structure could look like:
|
||||||
|
|
||||||
|
|
@ -129,14 +129,8 @@ You should see a very long JavaScript file for **ReDoc**.
|
||||||
It could start with something like:
|
It could start with something like:
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
/*!
|
/*! For license information please see redoc.standalone.js.LICENSE.txt */
|
||||||
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
|
||||||
* -------------------------------------------------------------
|
|
||||||
* Version: "2.0.0-rc.18"
|
|
||||||
* Repo: https://github.com/Redocly/redoc
|
|
||||||
*/
|
|
||||||
!function(e,t){"object"==typeof exports&&"object"==typeof m
|
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ Probablemente puedas hacer clic derecho en cada enlace y seleccionar una opción
|
||||||
|
|
||||||
Y **ReDoc** utiliza el archivo:
|
Y **ReDoc** utiliza el archivo:
|
||||||
|
|
||||||
* <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/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
|
||||||
|
|
||||||
Después de eso, tu estructura de archivos podría verse así:
|
Después de eso, tu estructura de archivos podría verse así:
|
||||||
|
|
||||||
|
|
@ -129,14 +129,8 @@ Deberías ver un archivo JavaScript muy largo de **ReDoc**.
|
||||||
Podría comenzar con algo como:
|
Podría comenzar con algo como:
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
/*!
|
/*! For license information please see redoc.standalone.js.LICENSE.txt */
|
||||||
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
|
||||||
* -------------------------------------------------------------
|
|
||||||
* Version: "2.0.0-rc.18"
|
|
||||||
* Repo: https://github.com/Redocly/redoc
|
|
||||||
*/
|
|
||||||
!function(e,t){"object"==typeof exports&&"object"==typeof m
|
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ Você provavelmente pode clicar com o botão direito em cada link e selecionar u
|
||||||
|
|
||||||
E o **ReDoc** usa os arquivos:
|
E o **ReDoc** usa os arquivos:
|
||||||
|
|
||||||
* <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/bundles/redoc.standalone.js" class="external-link" target="_blank">`redoc.standalone.js`</a>
|
||||||
|
|
||||||
Depois disso, sua estrutura de arquivos deve se parecer com:
|
Depois disso, sua estrutura de arquivos deve se parecer com:
|
||||||
|
|
||||||
|
|
@ -129,14 +129,8 @@ Você deverá ver um arquivo JavaScript muito longo para o **ReDoc**.
|
||||||
Esse arquivo pode começar com algo como:
|
Esse arquivo pode começar com algo como:
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
/*!
|
/*! For license information please see redoc.standalone.js.LICENSE.txt */
|
||||||
* ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):
|
||||||
* -------------------------------------------------------------
|
|
||||||
* Version: "2.0.0-rc.18"
|
|
||||||
* Repo: https://github.com/Redocly/redoc
|
|
||||||
*/
|
|
||||||
!function(e,t){"object"==typeof exports&&"object"==typeof m
|
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ async def redoc_html():
|
||||||
return get_redoc_html(
|
return get_redoc_html(
|
||||||
openapi_url=app.openapi_url,
|
openapi_url=app.openapi_url,
|
||||||
title=app.title + " - ReDoc",
|
title=app.title + " - ReDoc",
|
||||||
redoc_js_url="https://unpkg.com/redoc@next/bundles/redoc.standalone.js",
|
redoc_js_url="https://unpkg.com/redoc@2/bundles/redoc.standalone.js",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ def get_redoc_html(
|
||||||
It is normally set to a CDN URL.
|
It is normally set to a CDN URL.
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
] = "https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js",
|
] = "https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js",
|
||||||
redoc_favicon_url: Annotated[
|
redoc_favicon_url: Annotated[
|
||||||
str,
|
str,
|
||||||
Doc(
|
Doc(
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ def test_redoc():
|
||||||
response = client.get("/redoc")
|
response = client.get("/redoc")
|
||||||
assert response.status_code == 200, response.text
|
assert response.status_code == 200, response.text
|
||||||
assert response.headers["content-type"] == "text/html; charset=utf-8"
|
assert response.headers["content-type"] == "text/html; charset=utf-8"
|
||||||
assert "redoc@next" in response.text
|
assert "redoc@2" in response.text
|
||||||
|
|
||||||
|
|
||||||
def test_enum_status_code_response():
|
def test_enum_status_code_response():
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ def test_swagger_ui_oauth2_redirect_html(client: TestClient):
|
||||||
def test_redoc_html(client: TestClient):
|
def test_redoc_html(client: TestClient):
|
||||||
response = client.get("/redoc")
|
response = client.get("/redoc")
|
||||||
assert response.status_code == 200, response.text
|
assert response.status_code == 200, response.text
|
||||||
assert "https://unpkg.com/redoc@next/bundles/redoc.standalone.js" in response.text
|
assert "https://unpkg.com/redoc@2/bundles/redoc.standalone.js" in response.text
|
||||||
|
|
||||||
|
|
||||||
def test_api(client: TestClient):
|
def test_api(client: TestClient):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue