Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const (

// FeatureStoreSpec defines the desired state of FeatureStore
type FeatureStoreSpec struct {
// +kubebuilder:validation:Pattern="^[A-Za-z0-9][A-Za-z0-9_]*$"
// FeastProject is the Feast project id. This can be any alphanumeric string with underscores, but it cannot start with an underscore. Required.
// +kubebuilder:validation:Pattern="^[A-Za-z0-9][A-Za-z0-9_-]*$"
// FeastProject is the Feast project id. This can be any alphanumeric string with underscores and hyphens, but it cannot start with an underscore or hyphen. Required.
FeastProject string `json:"feastProject"`
FeastProjectDir *FeastProjectDir `json:"feastProjectDir,omitempty"`
Services *FeatureStoreServices `json:"services,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down Expand Up @@ -4423,7 +4423,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down Expand Up @@ -4423,7 +4423,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down
4 changes: 2 additions & 2 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down Expand Up @@ -4431,7 +4431,7 @@ spec:
type: object
feastProject:
description: FeastProject is the Feast project id.
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
pattern: ^[A-Za-z0-9][A-Za-z0-9_-]*$
type: string
feastProjectDir:
description: FeastProjectDir defines how to create the feast project
Expand Down
2 changes: 1 addition & 1 deletion infra/feast-operator/docs/api/markdown/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ _Appears in:_

| Field | Description |
| --- | --- |
| `feastProject` _string_ | FeastProject is the Feast project id. This can be any alphanumeric string with underscores, but it cannot start with an underscore. Required. |
| `feastProject` _string_ | FeastProject is the Feast project id. This can be any alphanumeric string with underscores and hyphens, but it cannot start with an underscore or hyphen. Required. |
| `feastProjectDir` _[FeastProjectDir](#feastprojectdir)_ | |
| `services` _[FeatureStoreServices](#featurestoreservices)_ | |
| `authz` _[AuthzConfig](#authzconfig)_ | |
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def is_valid(self):
if not is_valid_name(self.name):
raise ValueError(
f"Project name, {self.name}, should only have "
f"alphanumerical values and underscores but not start with an underscore."
f"alphanumerical values, underscores, and hyphens but not start with an underscore or hyphen."
)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def _validate_project_name(cls, v: str) -> str:
if not is_valid_name(v):
raise ValueError(
f"Project name, {v}, should only have "
f"alphanumerical values and underscores but not start with an underscore."
f"alphanumerical values, underscores, and hyphens but not start with an underscore or hyphen."
)
return v

Expand Down
10 changes: 6 additions & 4 deletions sdk/python/feast/repo_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def apply_total(repo_config: RepoConfig, repo_path: Path, skip_source_validation
if not is_valid_name(project.name):
print(
f"{project.name} is not valid. Project name should only have "
f"alphanumerical values and underscores but not start with an underscore."
f"alphanumerical values, underscores, and hyphens but not start with an underscore or hyphen."
)
sys.exit(1)
# TODO: When we support multiple projects in a single repo, we should filter repo contents by project. Currently there is no way to associate Feast objects to project.
Expand Down Expand Up @@ -445,7 +445,7 @@ def init_repo(repo_name: str, template: str):

if not is_valid_name(repo_name):
raise BadParameter(
message="Name should be alphanumeric values and underscores but not start with an underscore",
message="Name should be alphanumeric values, underscores, and hyphens but not start with an underscore or hyphen",
param_hint="PROJECT_DIRECTORY",
)
repo_path = Path(os.path.join(Path.cwd(), repo_name))
Expand Down Expand Up @@ -506,8 +506,10 @@ def init_repo(repo_name: str, template: str):


def is_valid_name(name: str) -> bool:
"""A name should be alphanumeric values and underscores but not start with an underscore"""
return not name.startswith("_") and re.compile(r"\W+").search(name) is None
"""A name should be alphanumeric values, underscores, and hyphens but not start with an underscore"""
return (
not name.startswith(("_", "-")) and re.compile(r"[^\w-]+").search(name) is None
)


def generate_project_name() -> str:
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/tests/unit/infra/scaffolding/test_repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ def test_invalid_project_name():
_test_config(
dedent(
"""
project: foo-1
project: -foo
registry: "registry.db"
provider: local
"""
),
expect_error="alphanumerical values ",
expect_error="alphanumerical values, underscores, and hyphens ",
)

_test_config(
Expand All @@ -185,7 +185,7 @@ def test_invalid_project_name():
provider: local
"""
),
expect_error="alphanumerical values ",
expect_error="alphanumerical values, underscores, and hyphens ",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def test_is_valid_name():
("invalid_name_", True),
("12345678901234567", True),
("too_long_name_123", True),
("hyphen-name", True),
# Invalid project name cases
("_invalidName", False),
("invalid-Name", False),
("invalid name", False),
("invalid@name", False),
("invalid$name", False),
Expand Down
Loading