Skip to content

Commit a1d735a

Browse files
Generate stackitmarketplace
1 parent e2e725c commit a1d735a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
import json
1818
import pprint
19+
import re
1920
from typing import Any, ClassVar, Dict, List, Optional, Set
2021

2122
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22-
from typing_extensions import Self
23+
from typing_extensions import Annotated, Self
2324

2425

2526
class SubscriptionProduct(BaseModel):
@@ -34,6 +35,9 @@ class SubscriptionProduct(BaseModel):
3435
product_id: StrictStr = Field(description="The product ID.", alias="productId")
3536
product_name: StrictStr = Field(description="The name of the product.", alias="productName")
3637
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+
)
3741
vendor_website_url: StrictStr = Field(description="The vendor's website.", alias="vendorWebsiteUrl")
3842
__properties: ClassVar[List[str]] = [
3943
"deliveryMethod",
@@ -43,6 +47,7 @@ class SubscriptionProduct(BaseModel):
4347
"productId",
4448
"productName",
4549
"vendorName",
50+
"vendorProductId",
4651
"vendorWebsiteUrl",
4752
]
4853

@@ -67,6 +72,16 @@ def price_type_validate_enum(cls, value):
6772
raise ValueError("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')")
6873
return value
6974

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+
7085
model_config = ConfigDict(
7186
populate_by_name=True,
7287
validate_assignment=True,
@@ -124,6 +139,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124139
"productId": obj.get("productId"),
125140
"productName": obj.get("productName"),
126141
"vendorName": obj.get("vendorName"),
142+
"vendorProductId": obj.get("vendorProductId"),
127143
"vendorWebsiteUrl": obj.get("vendorWebsiteUrl"),
128144
}
129145
)

0 commit comments

Comments
 (0)