Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RefactorFieldInfo creation implementation#11898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Viicos merged 12 commits intomainfromfieldinfo-cleanup
Jun 14, 2025
Merged
Changes from1 commit
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Updatejson_schema_extra warning test
The existing implementation did not warn when a callablewas used first, then a dict. Also use a plain `UserWarning`as `PydanticJsonSchemaWarning` is meant to be used*during* JSON Schema generation.
  • Loading branch information
@Viicos
Viicos committedMay 21, 2025
commitc0641b2c944e6e1360908e4b1075a72121419892
11 changes: 9 additions & 2 deletionstests/test_json_schema.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6680,13 +6680,20 @@ class Model(BaseModel):

def test_warn_on_mixed_compose() -> None:
with pytest.warns(
PydanticJsonSchemaWarning, match='Composing `dict` and `callable` type `json_schema_extra` is not supported.'
UserWarning, match='Composing `dict` and `callable` type `json_schema_extra` is not supported.'
):

classModel(BaseModel):
classModel1(BaseModel):
field: Annotated[int, Field(json_schema_extra={'a': 'dict'}), Field(json_schema_extra=lambda x: x.pop('a'))] # type: ignore


with pytest.warns(
UserWarning, match='Composing `dict` and `callable` type `json_schema_extra` is not supported.'
):
class Model2(BaseModel):
field: Annotated[int, Field(json_schema_extra=lambda x: x.pop('a')), Field(json_schema_extra={'a': 'dict'})] # type: ignore


def test_blank_title_is_respected() -> None:
class Model(BaseModel):
x: int
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp