|
12 | 12 | Do not edit the class manually. |
13 | 13 | """ # noqa: E501 |
14 | 14 |
|
15 | | - |
16 | 15 | from __future__ import annotations |
17 | 16 | import pprint |
18 | 17 | import re # noqa: F401 |
19 | 18 | import json |
20 | 19 |
|
21 | 20 |
|
22 | | -from typing import Optional |
23 | | -from pydantic import BaseModel, Field, StrictStr |
| 21 | + |
| 22 | + |
| 23 | +from pydantic import field_validator |
24 | 24 |
|
25 | 25 | class AddressDetails(BaseModel): |
26 | 26 | """ |
27 | 27 | Address associated with the customer. |
28 | 28 | """ |
29 | | - name: Optional[StrictStr] = Field(None, description="Full Name of the customer associated with the address.") |
30 | | - address_line_one: Optional[StrictStr] = Field(None, description="First line of the address.") |
31 | | - address_line_two: Optional[StrictStr] = Field(None, description="Second line of the address.") |
32 | | - country: Optional[StrictStr] = Field(None, description="Country Name.") |
33 | | - country_code: Optional[StrictStr] = Field(None, description="Country Code.") |
34 | | - state: Optional[StrictStr] = Field(None, description="State Name.") |
35 | | - state_code: Optional[StrictStr] = Field(None, description="State Code.") |
36 | | - city: Optional[StrictStr] = Field(None, description="City Name.") |
37 | | - pin_code: Optional[StrictStr] = Field(None, description="Pin Code/Zip Code.") |
38 | | - phone: Optional[StrictStr] = Field(None, description="Customer Phone Number.") |
39 | | - email: Optional[StrictStr] = Field(None, description="Cutomer Email Address.") |
| 29 | + name: Optional[StrictStr] = Field(default=None, description="Full Name of the customer associated with the address.") |
| 30 | + address_line_one: Optional[StrictStr] = Field(default=None, description="First line of the address.") |
| 31 | + address_line_two: Optional[StrictStr] = Field(default=None, description="Second line of the address.") |
| 32 | + country: Optional[StrictStr] = Field(default=None, description="Country Name.") |
| 33 | + country_code: Optional[StrictStr] = Field(default=None, description="Country Code.") |
| 34 | + state: Optional[StrictStr] = Field(default=None, description="State Name.") |
| 35 | + state_code: Optional[StrictStr] = Field(default=None, description="State Code.") |
| 36 | + city: Optional[StrictStr] = Field(default=None, description="City Name.") |
| 37 | + pin_code: Optional[StrictStr] = Field(default=None, description="Pin Code/Zip Code.") |
| 38 | + phone: Optional[StrictStr] = Field(default=None, description="Customer Phone Number.") |
| 39 | + email: Optional[StrictStr] = Field(default=None, description="Cutomer Email Address.") |
40 | 40 | __properties = ["name", "address_line_one", "address_line_two", "country", "country_code", "state", "state_code", "city", "pin_code", "phone", "email"] |
41 | 41 |
|
42 | | - class Config: |
43 | | - """Pydantic configuration""" |
44 | | - allow_population_by_field_name = True |
45 | | - validate_assignment = True |
| 42 | + # Updated to Pydantic v2 |
| 43 | + """Pydantic configuration""" |
| 44 | + model_config = { |
| 45 | + "populate_by_name": True, |
| 46 | + "validate_assignment": True |
| 47 | + } |
46 | 48 |
|
47 | 49 | def to_str(self) -> str: |
48 | 50 | """Returns the string representation of the model using alias""" |
|
0 commit comments