-
-
Notifications
You must be signed in to change notification settings - Fork 802
[OpenAPI] Add new validation rules / assertions #9030
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds new validation rules for OpenAPI definitions and refactors the error handling model from a result-based pattern to an exception-based pattern. The changes improve type safety by making operation and fragment definitions explicit properties rather than derived values.
Key changes:
- Replaced result-based parsing with exception-based parsing (throws
OpenApiDefinitionParsingExceptionon errors) - Added two new validation rules:
EndpointMustHaveOperationNameRuleandEndpointHttpMethodMustBeValidRule - Converted
OpenApiEndpointDefinitionandOpenApiModelDefinitionfrom records to classes with internal constructors and explicitOperationDefinition/FragmentDefinitionproperties
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
ValidationTestBase.cs |
Updated test to use new generic error message and added test for operation name validation |
OpenApiDefinitionParserTests.cs |
Updated all parsing tests to expect exceptions instead of checking result objects |
OpenApiTestBase.cs |
Updated test infrastructure to use OpenApiDefinitionValidationError instead of IOpenApiError and simplified parser usage |
OpenApiCollectionArchiveTests.cs |
Updated to use new parser signature that returns definitions directly |
ModelNoDeferStreamDirectiveRule.cs |
Removed definition parameter from validation error constructor |
EndpointParameterConflictRule.cs |
Removed definition parameter from validation error constructor |
EndpointNoDeferStreamDirectiveRule.cs |
Removed definition parameter from validation error constructor |
EndpointMustHaveValidRouteRule.cs |
Removed definition parameter from validation error constructor |
EndpointMustHaveSingleRootFieldRule.cs |
Removed definition parameter from validation error constructor |
EndpointMustHaveNameRule.cs |
New validation rule to ensure endpoints have operation names |
EndpointMustBeQueryOrMutationRule.cs |
Simplified error message and removed definition parameter from validation error constructor |
EndpointHttpMethodMustBeValidRule.cs |
New validation rule to ensure endpoints have valid HTTP methods |
OpenApiDefinitionValidator.cs |
Registered two new validation rules in the endpoint validation pipeline |
OpenApiDefinitionValidationError.cs |
Simplified to only contain message, removed IOpenApiError interface and definition reference |
OpenApiDefinitionParsingResult.cs |
Removed - no longer needed with exception-based parsing |
OpenApiDefinitionParsingException.cs |
New exception type for parsing failures |
OpenApiDefinitionParsingError.cs |
Removed - replaced by exception-based approach |
OpenApiDefinitionParser.cs |
Refactored to throw exceptions on parse errors, return definitions directly, and include operation/fragment nodes as explicit parameters |
IOpenApiError.cs |
Removed - no longer needed with simplified error model |
OpenApiDiagnosticEventListener.cs |
Updated signature to use OpenApiDefinitionValidationError instead of IOpenApiError |
IOpenApiDiagnosticEvents.cs |
Updated signature to use OpenApiDefinitionValidationError instead of IOpenApiError |
AggregateOpenApiDiagnosticEventListener.cs |
Updated signature to use OpenApiDefinitionValidationError instead of IOpenApiError |
OpenApiModelDefinition.cs |
Converted from record to class with internal constructor and explicit FragmentDefinition property |
OpenApiEndpointDefinitionParameter.cs |
Moved to separate file (previously nested in OpenApiEndpointDefinition.cs) |
OpenApiEndpointDefinition.cs |
Converted from record to class with internal constructor and explicit OperationDefinition property |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...te/Adapters/src/Adapters.OpenApi.Core/Validation/Rules/Endpoints/EndpointMustHaveNameRule.cs
Outdated
Show resolved
Hide resolved
...rs/src/Adapters.OpenApi.Core/Validation/Rules/Endpoints/EndpointMustBeQueryOrMutationRule.cs
Outdated
Show resolved
Hide resolved
🚀 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 20666439971 • Commit 05da2f8 • Fri, 02 Jan 2026 21:08:25 GMT |
cae2f0a to
b7249fd
Compare
🚀 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 20678722814 • Commit b539eec • Sat, 03 Jan 2026 15:00:30 GMT |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9030 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.