Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(validation): update Company validation expression #1043

Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend.

## Unreleased

## Feature

* **Registration**
* adjust legalEntityPattern REGEX to allow all language characters [#1043](https://github.com/eclipse-tractusx/portal-backend/pull/1043)

## 2.3.0-alpha.2

## Feature
Expand Down
2 changes: 1 addition & 1 deletion src/framework/Framework.Async/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Cors/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.DBAccess/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.IO/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Linq/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Logging/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Models/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
12 changes: 11 additions & 1 deletion src/framework/Framework.Models/ValidationExpressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public static class ValidationExpressions
public const string Name = @"^.+$";
public const string Bpn = @"^(BPNL|bpnl)[\w|\d]{12}$";
public const string Bpns = @"^(BPNS|bpns)[\w|\d]{12}$";
public const string Company = @"^(?!.*\s$)([\wÀ-ÿ£$€¥¢@%*+\-/\\,.:;=<>!?&^#'\x22()[\]]\s?){1,160}$";
/// <summary>
/// Regular expression pattern for validating legal company names.
/// </summary>
/// <remarks>
/// The pattern ensures the following:
/// - unicode category \p{L} for letters, \u0E00-\u0E7F for Thai characters
/// - digits, currency symbols, and various special characters.
/// - The string can have spaces between characters but not at the end.
/// - The length of the string must be between 1 and 160 characters.
/// </remarks>
public const string Company = @"^(?!.*\s$)([\p{L}\u0E00-\u0E7F\d\p{Sc}@%*+_\-/\\,.:;=<>!?&^#'\x22()[\]]\s?){1,160}$";
public const string ExternalCertificateNumber = @"^[a-zA-Z0-9]{0,36}$";
}
2 changes: 1 addition & 1 deletion src/framework/Framework.Seeding/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Swagger/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Token/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/framework/Framework.Web/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>2.10.0</VersionPrefix>
<VersionPrefix>2.11.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public class ValidationExpressionsTests
[InlineData("C", true)] // Minimum valid length
[InlineData("7-ELEVEN INTERNATIONAL LLC", true)]
[InlineData("Recht 24/7 Schröder Rechtsanwaltsgesellschaft mbH", true)]
[InlineData("ACE 9 SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ", true)]
[InlineData("GAMMO Europe Korlátolt Felelősségű Társaság", true)]
[InlineData("摩根亚太优势混合型证券投资基金 (QDII)", true)]
[InlineData("삼성", true)]
[InlineData("三", true)]
[InlineData("Currency £$€¥¢", true)]
[InlineData("Brackets []()", true)]
[InlineData("Punctuation !?,.;:", true)]
Expand All @@ -45,6 +50,25 @@ public class ValidationExpressionsTests
[InlineData("German: ÄÖÜß", true)]
[InlineData("+SEN Inc.", true)] // leading special character
[InlineData("Danish: ÆØÅ", true)]
[InlineData("Czech: ČĎŇŘŠŤŽŮů", true)]
[InlineData("Estonian: ÄÖÜŠŽ", true)]
[InlineData("Slovak: ĽĹŔŠŤŽ", true)]
[InlineData("Polish: ĄĆĘŁŃÓŚŹŻ", true)]
[InlineData("Hungarian: ÁÉÍÓÖŐÚÜŰ", true)]
[InlineData("Romanian: ÂÎŞŢ", true)]
[InlineData("Bulgarian: ЙЪЬ", true)]
[InlineData("Greek: ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", true)]
[InlineData("Turkish: ÇĞİıÖŞÜ", true)]
[InlineData("Arabic: ابتثجحخدذرزسشصضطظعغفقكلمنهوي", true)]
[InlineData("Hebrew: שלום עולם", true)]
[InlineData("Hindi: अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषस", true)]
[InlineData("Tamil: அஆஇஈஉஊஎஏஐஒஓஔகஙசஞடணதநனபமயரலவழளஷஸஹ", true)]
[InlineData("Japanese: あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん", true)]
[InlineData("Chinese: 你好 世界", true)]
[InlineData("Korean: 안녕하세요 세계", true)]
[InlineData("Vietnamese: ăâắáấàằầảẳẩãẵẫạặậđêéếèềẻểẽễẹệíìỉĩịôơóốớòồờỏổởõỗỡọộợưúứùừủửũữụựýỳỷỹỵ", true)]
[InlineData("Singapore: 你好 世界", true)]
[InlineData("Thai: สวัสดีชาวโลก", true)]
[InlineData("Bayerische Motoren Werke Aktiengesellschaft ", false)] // Ends with whitespace
[InlineData(" Bayerische Motoren Werke Aktiengesellschaft", false)] // starts with whitespace
[InlineData("Bayerische Motoren Werke Aktiengesellschaft", false)] // double whitespace
Expand Down
Loading