[OpenAPI] Improve missing query parameter error#9492
Merged
tobias-tengler merged 2 commits intomainfrom Mar 31, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve the HTTP endpoint error returned when a required query parameter is missing, providing a clearer 400 Bad Request response and adding a regression test for the behavior.
Changes:
- Add a new GET integration test covering missing required query parameters and snapshot the expected problem+json response.
- Extend the test schema with a paginated search field requiring a non-null argument.
- Update
DynamicEndpointMiddlewareto throw aBadRequestExceptionwhen a required route/query parameter is missing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/TestSchema.cs | Adds SearchProductsPaginated to support the new integration test scenario. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/HttpEndpointIntegrationTestBase.cs | Adds an integration test for a missing required query parameter. |
| src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/snapshots/HttpEndpointIntegrationTestBase.Http_Get_With_Missing_Required_Query_Parameter.snap | Adds the expected 400 problem+json snapshot output. |
| src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Execution/DynamicEndpointMiddleware.cs | Adds missing-required parameter checks for route/query parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Execution/DynamicEndpointMiddleware.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/Execution/DynamicEndpointMiddleware.cs
Outdated
Show resolved
Hide resolved
9344079 to
8da578a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9492 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.