Skip to content

Commit f90baf7

Browse files
Generate stackitmarketplace
1 parent 5e53c6e commit f90baf7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class CatalogProductDetail(BaseModel):
6363
default=None, description="The list of categories associated to the product."
6464
)
6565
delivery_method: DeliveryMethod = Field(alias="deliveryMethod")
66+
demo_url: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field(
67+
default=None, description="The URL to a demo if available.", alias="demoUrl"
68+
)
6669
description: StrictStr = Field(description="The product description.")
6770
documentation_url: Annotated[str, Field(strict=True, max_length=512)] = Field(
6871
description="The documentation URL.", alias="documentationUrl"
@@ -108,6 +111,7 @@ class CatalogProductDetail(BaseModel):
108111
"assets",
109112
"categories",
110113
"deliveryMethod",
114+
"demoUrl",
111115
"description",
112116
"documentationUrl",
113117
"email",
@@ -129,6 +133,18 @@ class CatalogProductDetail(BaseModel):
129133
"videoUrl",
130134
]
131135

136+
@field_validator("demo_url")
137+
def demo_url_validate_regular_expression(cls, value):
138+
"""Validates the regular expression"""
139+
if value is None:
140+
return value
141+
142+
if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value):
143+
raise ValueError(
144+
r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/"
145+
)
146+
return value
147+
132148
@field_validator("documentation_url")
133149
def documentation_url_validate_regular_expression(cls, value):
134150
"""Validates the regular expression"""
@@ -260,6 +276,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
260276
"assets": Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None,
261277
"categories": obj.get("categories"),
262278
"deliveryMethod": obj.get("deliveryMethod"),
279+
"demoUrl": obj.get("demoUrl"),
263280
"description": obj.get("description"),
264281
"documentationUrl": obj.get("documentationUrl"),
265282
"email": obj.get("email"),

0 commit comments

Comments
 (0)