We're currently upgrading from v13 to v14.3 and noticed that CreateTenantInput.Name now has [RegularExpression(TenantConsts.TenancyNameRegex)] applied, restricting the display name to the same URL-slug format as TenancyName — meaning values like "Acme Corp" would fail validation on create. We have existing tenant records whose Name values don't match this regex, so we're planning to remove the [RegularExpression] attribute from Name manually, but wanted to check first whether this was intentional and if there's something we're missing about how the tenant Name field is expected to be used. For reference, TenantEditDto.Name does not carry this attribute, so there's already an inconsistency between create and edit validation.
1 Answer(s)
-
0
Hi @jlennard
Thanks for pointing this out. You are right to question this.
In ASP.NET Zero,
TenancyNameandNamehave different purposes:TenancyNameis the unique tenant identifier and can be used for URL/subdomain-style tenant resolution, soTenantConsts.TenancyNameRegexis expected there.Nameis the tenant display name. Values likeAcme Corpshould be valid for this field.
So applying
TenantConsts.TenancyNameRegextoCreateTenantInput.Nameis not necessary for the display name, and the fact thatTenantEditDto.Namedoes not have the same attribute also shows an inconsistency between create and edit validation.You can remove the
[RegularExpression(TenantConsts.TenancyNameRegex)]attribute fromCreateTenantInput.Namein your project. If you are using the React, Angular or MVC UI, also check the client-sidepattern/regexvalidation on the tenant create/edit forms so the UI and backend remain consistent.Existing tenant records do not need to be changed. Only
TenancyNameshould continue to follow the slug style format.Thanks for reporting this; we will review it on our side as well.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)