Updated .NET regular expressions to use \z instead of $#9026
Conversation
🚀 Fusion Gateway Performance ResultsSimple Composite QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
}
}
}
}Deep Recursion QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
users {
...User
reviews {
...Review
product {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}
}
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}Variable Batching ThroughputConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query query TestQuery_8f7a46ce_2(
$__fusion_1_upc: ID!
$__fusion_2_price: Long!
$__fusion_2_weight: Long!
) {
productByUpc(upc: $__fusion_1_upc) {
inStock
shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
}
}Variables (5 sets batched in single request) [
{ "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
{ "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
{ "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]No baseline data available for comparison. Run 20597666729 • Commit c0d4bd3 • Tue, 30 Dec 2025 13:58:42 GMT |
There was a problem hiding this comment.
Pull request overview
Updates scalar validation regex patterns in HotChocolate’s .NET implementation to use \z instead of $ for end-of-string anchoring, tightening validation so inputs with trailing newlines don’t match.
Changes:
- Replaced
$with\zin multiple scalar validation regex patterns. - Converted several patterns to verbatim string literals (
@"...") to simplify escaping. - Updated the
RegexTypeTestsstub pattern accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Types.Scalars.Tests/RegexTypeTests.cs | Updates test stub regex pattern to use \z. |
| src/HotChocolate/Core/src/Types.Scalars/PhoneNumberType.cs | Tightens E.164 phone validation by anchoring with \z. |
| src/HotChocolate/Core/src/Types.Scalars/MacAddressType.cs | Tightens MAC address validation end anchor to \z. |
| src/HotChocolate/Core/src/Types.Scalars/LongitudeType.cs | Updates sexagesimal parsing regex to use \z and verbatim strings. |
| src/HotChocolate/Core/src/Types.Scalars/LatitudeType.cs | Updates sexagesimal parsing regex to use \z and verbatim strings. |
| src/HotChocolate/Core/src/Types.Scalars/IsbnType.cs | Updates complex ISBN validation regex to use \z (including lookaheads). |
| src/HotChocolate/Core/src/Types.Scalars/IPv6Type.cs | Replaces final $ anchor with \z in IPv6(+CIDR) validation. |
| src/HotChocolate/Core/src/Types.Scalars/IPv4Type.cs | Replaces final $ anchor with \z and switches to verbatim strings. |
| src/HotChocolate/Core/src/Types.Scalars/HexColorType.cs | Tightens hex color validation end anchor to \z. |
| src/HotChocolate/Core/src/Types.Scalars/EmailAddressType.cs | Tightens email validation end anchor to \z and switches to verbatim strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Regex that validates the standard E.164 format | ||
| /// </summary> | ||
| private const string ValidationPattern = "^\\+[1-9][0-9]{2,14}$"; | ||
| private const string ValidationPattern = @"^\+[1-9][0-9]{2,14}\z"; |
There was a problem hiding this comment.
The switch from $ to \z changes matching semantics (values with a trailing newline will no longer match). Consider adding an explicit negative test case (e.g., a valid value plus \n / \r\n) to lock in the intended behavior and prevent regressions.
🚀 Fusion Gateway Performance ResultsSimple Composite QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
}
}
}
}Deep Recursion QueryConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query fragment User on User {
id
username
name
}
fragment Review on Review {
id
body
}
fragment Product on Product {
inStock
name
price
shippingEstimate
upc
weight
}
query TestQuery {
users {
...User
reviews {
...Review
product {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}
}
topProducts(first: 5) {
...Product
reviews {
...Review
author {
...User
reviews {
...Review
product {
...Product
}
}
}
}
}
}Variable Batching ThroughputConstant Load (50 VUs)
📊 Response Time Metrics
Ramping Load (0→50→500→50 VUs)
📊 Response Time Metrics
Executed Query query TestQuery_8f7a46ce_2(
$__fusion_1_upc: ID!
$__fusion_2_price: Long!
$__fusion_2_weight: Long!
) {
productByUpc(upc: $__fusion_1_upc) {
inStock
shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
}
}Variables (5 sets batched in single request) [
{ "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
{ "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
{ "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
{ "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]No baseline data available for comparison. Run 21800807056 • Commit 832c269 • Sun, 08 Feb 2026 15:59:53 GMT |
Summary of the changes (Less than 80 chars)
\zinstead of$.Merge after #8931.