16
16
17
17
import json
18
18
import pprint
19
+ import re
19
20
from typing import Any , ClassVar , Dict , List , Optional , Set
20
21
21
22
from pydantic import BaseModel , ConfigDict , Field , StrictStr , field_validator
22
- from typing_extensions import Self
23
+ from typing_extensions import Annotated , Self
23
24
24
25
25
26
class SubscriptionProduct (BaseModel ):
@@ -34,6 +35,9 @@ class SubscriptionProduct(BaseModel):
34
35
product_id : StrictStr = Field (description = "The product ID." , alias = "productId" )
35
36
product_name : StrictStr = Field (description = "The name of the product." , alias = "productName" )
36
37
vendor_name : StrictStr = Field (description = "The product's vendor name." , alias = "vendorName" )
38
+ vendor_product_id : Optional [Annotated [str , Field (strict = True )]] = Field (
39
+ default = None , description = "The product ID provided by the Vendor." , alias = "vendorProductId"
40
+ )
37
41
vendor_website_url : StrictStr = Field (description = "The vendor's website." , alias = "vendorWebsiteUrl" )
38
42
__properties : ClassVar [List [str ]] = [
39
43
"deliveryMethod" ,
@@ -43,6 +47,7 @@ class SubscriptionProduct(BaseModel):
43
47
"productId" ,
44
48
"productName" ,
45
49
"vendorName" ,
50
+ "vendorProductId" ,
46
51
"vendorWebsiteUrl" ,
47
52
]
48
53
@@ -67,6 +72,16 @@ def price_type_validate_enum(cls, value):
67
72
raise ValueError ("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')" )
68
73
return value
69
74
75
+ @field_validator ("vendor_product_id" )
76
+ def vendor_product_id_validate_regular_expression (cls , value ):
77
+ """Validates the regular expression"""
78
+ if value is None :
79
+ return value
80
+
81
+ if not re .match (r"^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$" , value ):
82
+ raise ValueError (r"must validate the regular expression /^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$/" )
83
+ return value
84
+
70
85
model_config = ConfigDict (
71
86
populate_by_name = True ,
72
87
validate_assignment = True ,
@@ -124,6 +139,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124
139
"productId" : obj .get ("productId" ),
125
140
"productName" : obj .get ("productName" ),
126
141
"vendorName" : obj .get ("vendorName" ),
142
+ "vendorProductId" : obj .get ("vendorProductId" ),
127
143
"vendorWebsiteUrl" : obj .get ("vendorWebsiteUrl" ),
128
144
}
129
145
)
0 commit comments