Skip to content

Commit a68f28b

Browse files
committed
Fix incorrect default value in test schema for FamilyPets
1 parent ebaba8f commit a68f28b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class Family(BaseModel):
3232

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

3840

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)