Skip to content

Commit ad58a89

Browse files
committed
Fix incorrect default value in test schema for FamilyPets
1 parent 3146f44 commit ad58a89

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

tests/data/expected/main/jsonschema/has_default_value_pydantic_v2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TeamType(Enum):
1717

1818

1919
class ID(RootModel[str]):
20-
root: str
20+
root: str = 'abc'
2121

2222

2323
class Pet(BaseModel):
@@ -32,7 +32,9 @@ class Family(RootModel[list[ID]]):
3232

3333
class FamilyPets(RootModel[list[Pet]]):
3434
root: list[Pet] = Field(
35-
default_factory=lambda: [Pet.model_validate(v) for v in ['taro', 'shiro']]
35+
default_factory=lambda: [
36+
Pet.model_validate(v) for v in [{'name': 'taro'}, {'name': 'shiro'}]
37+
]
3638
)
3739

3840

tests/data/jsonschema/has_default_value.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"$ref": "#/definitions/Pet"
4646
},
4747
"default": [
48-
"taro",
49-
"shiro"
48+
{"name": "taro"},
49+
{"name": "shiro"}
5050
]
5151
}
5252
},

0 commit comments

Comments
 (0)