diff --git a/backend/capellacollab/settings/modelsources/t4c/repositories/models.py b/backend/capellacollab/settings/modelsources/t4c/repositories/models.py index e15201c16..ebe644770 100644 --- a/backend/capellacollab/settings/modelsources/t4c/repositories/models.py +++ b/backend/capellacollab/settings/modelsources/t4c/repositories/models.py @@ -44,7 +44,9 @@ class DatabaseT4CRepository(database.Base): class CreateT4CRepository(pydantic.BaseModel): - name: str + name: str = pydantic.Field( + pattern="^[-a-zA-Z0-9_]+$", examples=["testrepo"] + ) class T4CRepositoryStatus(str, enum.Enum): diff --git a/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.html b/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.html index 7249ff4ec..5e03c7df2 100644 --- a/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.html +++ b/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.html @@ -35,9 +35,12 @@ Repository - Repository already exists + + Repository already exists + + + The following characters are allowed: A-Z, a-z, 0-9, _, - + diff --git a/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.ts b/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.ts index 30e947c32..83960f487 100644 --- a/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.ts +++ b/frontend/src/app/projects/models/model-source/t4c/create-t4c-model-new-repository/create-t4c-model-new-repository.component.ts @@ -43,8 +43,13 @@ export class CreateT4cModelNewRepositoryComponent implements OnInit { t4cInstanceId: new FormControl(null, Validators.required), t4cRepositoryName: new FormControl( { value: null, disabled: true }, - Validators.required, - this.t4cRepoService.asyncNameValidator(), + { + validators: [ + Validators.required, + Validators.pattern(/^[-a-zA-Z0-9_]+$/), + ], + asyncValidators: this.t4cRepoService.asyncNameValidator(), + }, ), t4cProjectName: new FormControl( { value: null, disabled: true },