mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-09 13:51:25 -05:00
Compare commits
3 Commits
master
...
fix-on_sta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
404aadf1d7 | ||
|
|
267f099ac8 | ||
|
|
4561d575b7 |
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -14,7 +14,6 @@ on:
|
||||
|
||||
env:
|
||||
UV_NO_SYNC: true
|
||||
INLINE_SNAPSHOT_DEFAULT_FLAGS: review
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
|
||||
@@ -7,24 +7,10 @@ hide:
|
||||
|
||||
## Latest Changes
|
||||
|
||||
### Internal
|
||||
|
||||
* 🔧 Configure `test` workflow to run tests with `inline-snapshot=review`. PR [#14876](https://github.com/fastapi/fastapi/pull/14876) by [@YuriiMotov](https://github.com/YuriiMotov).
|
||||
|
||||
## 0.128.6
|
||||
|
||||
### Fixes
|
||||
|
||||
* 🐛 Fix `on_startup` and `on_shutdown` parameters of `APIRouter`. PR [#14873](https://github.com/fastapi/fastapi/pull/14873) by [@YuriiMotov](https://github.com/YuriiMotov).
|
||||
|
||||
### Translations
|
||||
|
||||
* 🌐 Update translations for zh (update-outdated). PR [#14843](https://github.com/fastapi/fastapi/pull/14843) by [@tiangolo](https://github.com/tiangolo).
|
||||
|
||||
### Internal
|
||||
|
||||
* ✅ Fix parameterized tests with snapshots. PR [#14875](https://github.com/fastapi/fastapi/pull/14875) by [@YuriiMotov](https://github.com/YuriiMotov).
|
||||
|
||||
## 0.128.5
|
||||
|
||||
### Refactors
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
||||
|
||||
__version__ = "0.128.6"
|
||||
__version__ = "0.128.5"
|
||||
|
||||
from starlette import status as status
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Annotated
|
||||
import pytest
|
||||
from fastapi import FastAPI, Path
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import Is, snapshot
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -58,8 +58,8 @@ def test_schema(path: str, expected_name: str, expected_title: str):
|
||||
[
|
||||
{
|
||||
"required": True,
|
||||
"schema": {"title": Is(expected_title), "type": "string"},
|
||||
"name": Is(expected_name),
|
||||
"schema": {"title": expected_title, "type": "string"},
|
||||
"name": expected_name,
|
||||
"in": "path",
|
||||
}
|
||||
]
|
||||
|
||||
@@ -3,7 +3,7 @@ import importlib
|
||||
import pytest
|
||||
from dirty_equals import IsList
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import Is, snapshot
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from ...utils import needs_py310
|
||||
|
||||
@@ -212,7 +212,7 @@ def test_openapi_schema(client: TestClient, mod_name: str):
|
||||
"title": "Tax",
|
||||
"anyOf": [{"type": "number"}, {"type": "null"}],
|
||||
},
|
||||
"tags": Is(tags_schema),
|
||||
"tags": tags_schema,
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
|
||||
@@ -2,7 +2,7 @@ import importlib
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import Is, snapshot
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
@@ -59,7 +59,7 @@ def test_openapi_schema(client: TestClient, mod_name: str):
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": Is(response_content),
|
||||
"content": response_content,
|
||||
}
|
||||
},
|
||||
"summary": "Read Items",
|
||||
|
||||
@@ -4,7 +4,7 @@ from textwrap import dedent
|
||||
import pytest
|
||||
from dirty_equals import IsList
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import Is, snapshot
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from ...utils import needs_py310
|
||||
|
||||
@@ -75,7 +75,7 @@ def test_openapi_schema(client: TestClient, mod_name: str):
|
||||
"/items/": {
|
||||
"post": {
|
||||
"summary": "Create an item",
|
||||
"description": Is(DESCRIPTIONS[mod_name]),
|
||||
"description": DESCRIPTIONS[mod_name],
|
||||
"operationId": "create_item_items__post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
|
||||
@@ -3,7 +3,7 @@ import importlib
|
||||
import pytest
|
||||
from fastapi._compat import PYDANTIC_VERSION_MINOR_TUPLE
|
||||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import Is, snapshot
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from ...utils import needs_py310
|
||||
|
||||
@@ -66,23 +66,6 @@ def test_query_params_str_validations_item_query_nonregexquery(client: TestClien
|
||||
def test_openapi_schema(client: TestClient):
|
||||
response = client.get("/openapi.json")
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
parameters_schema = {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"maxLength": 50,
|
||||
"pattern": "^fixedquery$",
|
||||
},
|
||||
{"type": "null"},
|
||||
],
|
||||
"title": "Query string",
|
||||
"description": "Query string for the items to search in the database that have a good match",
|
||||
# See https://github.com/pydantic/pydantic/blob/80353c29a824c55dea4667b328ba8f329879ac9f/tests/test_fastapi.sh#L25-L34.
|
||||
**({"deprecated": True} if PYDANTIC_VERSION_MINOR_TUPLE >= (2, 10) else {}),
|
||||
}
|
||||
|
||||
assert response.json() == snapshot(
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
@@ -113,7 +96,25 @@ def test_openapi_schema(client: TestClient):
|
||||
"description": "Query string for the items to search in the database that have a good match",
|
||||
"required": False,
|
||||
"deprecated": True,
|
||||
"schema": Is(parameters_schema),
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"maxLength": 50,
|
||||
"pattern": "^fixedquery$",
|
||||
},
|
||||
{"type": "null"},
|
||||
],
|
||||
"title": "Query string",
|
||||
"description": "Query string for the items to search in the database that have a good match",
|
||||
# See https://github.com/pydantic/pydantic/blob/80353c29a824c55dea4667b328ba8f329879ac9f/tests/test_fastapi.sh#L25-L34.
|
||||
**(
|
||||
{"deprecated": True}
|
||||
if PYDANTIC_VERSION_MINOR_TUPLE >= (2, 10)
|
||||
else {}
|
||||
),
|
||||
},
|
||||
"name": "item-query",
|
||||
"in": "query",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user