From 788033b212e8cd5ef32d520b82b12eabb3bafa39 Mon Sep 17 00:00:00 2001 From: Denis Cavrois Date: Fri, 19 Jan 2024 10:14:17 +0100 Subject: [PATCH] feat: support oci protocol. fix #2 --- pyhelm3/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyhelm3/models.py b/pyhelm3/models.py index 9a2aedd..dc7aac8 100644 --- a/pyhelm3/models.py +++ b/pyhelm3/models.py @@ -14,10 +14,12 @@ FilePath, AnyUrl as PydanticAnyUrl, HttpUrl as PydanticHttpUrl, + UrlConstraints as PydanticUrlConstraints, constr, field_validator ) from pydantic.functional_validators import AfterValidator +from typing_extensions import Annotated from .command import Command, SafeLoader @@ -46,6 +48,10 @@ def __init__(self, _command: Command, **kwargs): SemVerVersion = constr(pattern = r"^v?\d+\.\d+\.\d+(-[a-zA-Z0-9\.\-]+)?(\+[a-zA-Z0-9\.\-]+)?$") +#: Type for an OCI scheme URI +OciUrl = Annotated[PydanticAnyUrl, PydanticUrlConstraints(allowed_schemes=["oci"], host_required=True)] + + #: Type variables for forward references to the chart and release types ChartType = t.TypeVar("ChartType", bound = "Chart") ReleaseType = t.TypeVar("ReleaseType", bound = "Release") @@ -195,7 +201,7 @@ class Chart(ModelWithCommand): """ Model for a reference to a chart. """ - ref: t.Union[DirectoryPath, FilePath, HttpUrl, Name] = Field( + ref: t.Union[DirectoryPath, FilePath, HttpUrl, OciUrl, Name] = Field( ..., description = ( "The chart reference. "