mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-23 05:19:46 -05:00
Compare commits
10 Commits
use-extern
...
additional
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
841c5c3189 | ||
|
|
fa7a5d38a7 | ||
|
|
cf7d4fe7b7 | ||
|
|
02d8c6e258 | ||
|
|
597b435ae7 | ||
|
|
74cc27fd5a | ||
|
|
f1a39cab12 | ||
|
|
509afeb475 | ||
|
|
6e47171e9c | ||
|
|
b9b75ba5f1 |
1
.github/labeler.yml
vendored
1
.github/labeler.yml
vendored
@@ -31,6 +31,7 @@ internal:
|
||||
- .pre-commit-config.yaml
|
||||
- pdm_build.py
|
||||
- requirements*.txt
|
||||
- uv.lock
|
||||
- docs/en/data/sponsors.yml
|
||||
- docs/en/overrides/main.html
|
||||
- all-globs-to-all-files:
|
||||
|
||||
@@ -189,7 +189,7 @@ Siehe Abschnitt `### Links` im allgemeinen Prompt in `scripts/translate.py`.
|
||||
|
||||
////
|
||||
|
||||
## HTML „abbr“-Elemente { #html-abbr-elements }
|
||||
## HTML-„abbr“-Elemente { #html-abbr-elements }
|
||||
|
||||
//// tab | Test
|
||||
|
||||
|
||||
@@ -56,19 +56,19 @@ from app.routers import items
|
||||
|
||||
Die gleiche Dateistruktur mit Kommentaren:
|
||||
|
||||
```
|
||||
```bash
|
||||
.
|
||||
├── app # „app“ ist ein Python-Package
|
||||
│ ├── __init__.py # diese Datei macht „app“ zu einem „Python-Package“
|
||||
│ ├── main.py # „main“-Modul, z. B. import app.main
|
||||
│ ├── dependencies.py # „dependencies“-Modul, z. B. import app.dependencies
|
||||
│ └── routers # „routers“ ist ein „Python-Subpackage“
|
||||
│ │ ├── __init__.py # macht „routers“ zu einem „Python-Subpackage“
|
||||
│ │ ├── items.py # „items“-Submodul, z. B. import app.routers.items
|
||||
│ │ └── users.py # „users“-Submodul, z. B. import app.routers.users
|
||||
│ └── internal # „internal“ ist ein „Python-Subpackage“
|
||||
│ ├── __init__.py # macht „internal“ zu einem „Python-Subpackage“
|
||||
│ └── admin.py # „admin“-Submodul, z. B. import app.internal.admin
|
||||
├── app # "app" ist ein Python-Package
|
||||
│ ├── __init__.py # diese Datei macht "app" zu einem "Python-Package"
|
||||
│ ├── main.py # "main"-Modul, z. B. import app.main
|
||||
│ ├── dependencies.py # "dependencies"-Modul, z. B. import app.dependencies
|
||||
│ └── routers # "routers" ist ein "Python-Subpackage"
|
||||
│ │ ├── __init__.py # macht "routers" zu einem "Python-Subpackage"
|
||||
│ │ ├── items.py # "items"-Submodul, z. B. import app.routers.items
|
||||
│ │ └── users.py # "users"-Submodul, z. B. import app.routers.users
|
||||
│ └── internal # "internal" ist ein "Python-Subpackage"
|
||||
│ ├── __init__.py # macht "internal" zu einem "Python-Subpackage"
|
||||
│ └── admin.py # "admin"-Submodul, z. B. import app.internal.admin
|
||||
```
|
||||
|
||||
## `APIRouter` { #apirouter }
|
||||
@@ -479,7 +479,7 @@ $ fastapi dev app/main.py
|
||||
|
||||
</div>
|
||||
|
||||
und öffnen Sie die Dokumentation unter <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
|
||||
Und öffnen Sie die Dokumentation unter <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
|
||||
|
||||
Sie sehen die automatische API-Dokumentation, einschließlich der Pfade aller Submodule, mit den richtigen Pfaden (und Präfixen) und den richtigen Tags:
|
||||
|
||||
|
||||
@@ -60,8 +60,7 @@ FastAPI also includes these JavaScript-only `presets` settings:
|
||||
|
||||
```JavaScript
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
SwaggerUIBundle.presets.apis
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ hide:
|
||||
|
||||
### Translations
|
||||
|
||||
* 🌐 Update translations for de (update-outdated). PR [#14690](https://github.com/fastapi/fastapi/pull/14690) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🌐 Update LLM prompt for Russian translations. PR [#14733](https://github.com/fastapi/fastapi/pull/14733) by [@YuriiMotov](https://github.com/YuriiMotov).
|
||||
* 🌐 Update translations for ru (update-outdated). PR [#14693](https://github.com/fastapi/fastapi/pull/14693) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🌐 Update translations for pt (update-outdated). PR [#14724](https://github.com/fastapi/fastapi/pull/14724) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🌐 Update Korean LLM prompt. PR [#14740](https://github.com/fastapi/fastapi/pull/14740) by [@hard-coders](https://github.com/hard-coders).
|
||||
@@ -34,6 +36,7 @@ hide:
|
||||
|
||||
### Internal
|
||||
|
||||
* 🔧 Ensure that an edit to `uv.lock` gets the `internal` label. PR [#14759](https://github.com/fastapi/fastapi/pull/14759) by [@svlandeg](https://github.com/svlandeg).
|
||||
* 🔧 Update sponsors: remove Requestly. PR [#14735](https://github.com/fastapi/fastapi/pull/14735) by [@tiangolo](https://github.com/tiangolo).
|
||||
* 🔧 Update sponsors, LambdaTest changes to TestMu AI. PR [#14734](https://github.com/fastapi/fastapi/pull/14734) by [@tiangolo](https://github.com/tiangolo).
|
||||
* ⬆ Bump actions/cache from 4 to 5. PR [#14511](https://github.com/fastapi/fastapi/pull/14511) by [@dependabot[bot]](https://github.com/apps/dependabot).
|
||||
|
||||
@@ -90,5 +90,12 @@ For the following technical terms, use these specific translations to ensure con
|
||||
* serve (meaning providing access to something): «отдавать» (or `предоставлять доступ к`)
|
||||
* recap (noun): резюме
|
||||
* utility function: вспомогательная функция
|
||||
* fast to code: позволяет быстро писать код
|
||||
* Tutorial - User Guide: Учебник - Руководство пользователя
|
||||
* submodule: подмодуль
|
||||
* subpackage: подпакет
|
||||
* router: роутер
|
||||
* building, deploying, accessing (when describing features of FastAPI Cloud): созданиe образа, развертывание и доступ
|
||||
* type checker tool: инструмент проверки типов
|
||||
|
||||
Do not add whitespace in `т.д.`, `т.п.`.
|
||||
|
||||
@@ -54,6 +54,14 @@ def get_swagger_ui_html(
|
||||
"""
|
||||
),
|
||||
] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js",
|
||||
swagger_extra_js_urls: Annotated[
|
||||
Optional[list[str]],
|
||||
Doc(
|
||||
"""
|
||||
The URLs of additional JavaScript files to include.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
swagger_css_url: Annotated[
|
||||
str,
|
||||
Doc(
|
||||
@@ -98,6 +106,14 @@ def get_swagger_ui_html(
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
swagger_extra_presets: Annotated[
|
||||
Optional[list[str]],
|
||||
Doc(
|
||||
"""
|
||||
Extra presets to add to Swagger UI.
|
||||
"""
|
||||
),
|
||||
] = None,
|
||||
) -> HTMLResponse:
|
||||
"""
|
||||
Generate and return the HTML that loads Swagger UI for the interactive
|
||||
@@ -114,6 +130,13 @@ def get_swagger_ui_html(
|
||||
if swagger_ui_parameters:
|
||||
current_swagger_ui_parameters.update(swagger_ui_parameters)
|
||||
|
||||
js_urls = [swagger_js_url]
|
||||
if swagger_extra_js_urls:
|
||||
js_urls.extend(swagger_extra_js_urls)
|
||||
scripts_str = "\n ".join(
|
||||
f'<script src="{js_url}"></script>' for js_url in js_urls
|
||||
)
|
||||
|
||||
html = f"""
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -125,7 +148,7 @@ def get_swagger_ui_html(
|
||||
<body>
|
||||
<div id="swagger-ui">
|
||||
</div>
|
||||
<script src="{swagger_js_url}"></script>
|
||||
{scripts_str}
|
||||
<!-- `SwaggerUIBundle` is now available on the page -->
|
||||
<script>
|
||||
const ui = SwaggerUIBundle({{
|
||||
@@ -138,12 +161,18 @@ def get_swagger_ui_html(
|
||||
if oauth2_redirect_url:
|
||||
html += f"oauth2RedirectUrl: window.location.origin + '{oauth2_redirect_url}',"
|
||||
|
||||
html += """
|
||||
presets = ["SwaggerUIBundle.presets.apis"]
|
||||
if swagger_extra_presets:
|
||||
presets.extend(swagger_extra_presets)
|
||||
presets_str = ",\n ".join(presets)
|
||||
|
||||
html += f"""
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
{presets_str},
|
||||
],
|
||||
})"""
|
||||
"""
|
||||
|
||||
html += " })"
|
||||
|
||||
if init_oauth:
|
||||
html += f"""
|
||||
|
||||
@@ -18,9 +18,6 @@ def test_swagger_ui():
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
@@ -21,9 +21,6 @@ def test_swagger_ui():
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
@@ -24,9 +24,6 @@ def test_swagger_ui():
|
||||
assert "SwaggerUIBundle.presets.apis," in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert "SwaggerUIBundle.SwaggerUIStandalonePreset" in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
assert '"layout": "BaseLayout",' in response.text, (
|
||||
"default configs should be preserved"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user