@@ -10,15 +10,15 @@ open Fable.Python.Pydantic
1010// ============================================================================
1111
1212/// User model - a Pydantic BaseModel
13- [<Py.ClassAttributes ( style = Py.ClassAttributeStyle.Attributes , init = false ) >]
13+ [<Py.DataClass >]
1414type User ( Id : int , Name : string , Email : string ) =
1515 inherit BaseModel()
1616 member val Id : int = Id with get, set
1717 member val Name : string = Name with get, set
1818 member val Email : string = Email with get, set
1919
2020/// Request model for creating a new user
21- [<Py.ClassAttributes ( style = Py.ClassAttributeStyle.Attributes , init = false ) >]
21+ [<Py.DataClass >]
2222type CreateUserRequest ( Name : string , Email : string ) =
2323 inherit BaseModel()
2424 member val Name : string = Name with get, set
@@ -29,7 +29,7 @@ type CreateUserRequest(Name: string, Email: string) =
2929// ============================================================================
3030
3131/// Item model - a Pydantic BaseModel
32- [<Py.ClassAttributes ( style = Py.ClassAttributeStyle.Attributes , init = false ) >]
32+ [<Py.DataClass >]
3333type Item ( Id : int , Name : string , Price : float , InStock : bool ) =
3434 inherit BaseModel()
3535 member val Id : int = Id with get, set
@@ -38,7 +38,7 @@ type Item(Id: int, Name: string, Price: float, InStock: bool) =
3838 member val InStock : bool = InStock with get, set
3939
4040/// Request model for creating/updating an item
41- [<Py.ClassAttributes ( style = Py.ClassAttributeStyle.Attributes , init = false ) >]
41+ [<Py.DataClass >]
4242type CreateItemRequest ( Name : string , Price : float , InStock : bool ) =
4343 inherit BaseModel()
4444 member val Name : string = Name with get, set
0 commit comments