Skip to content

[OpenAPI] Improve missing query parameter error#9492

Merged
tobias-tengler merged 2 commits intomainfrom
tte/improve-missing-query-parameter-error
Mar 31, 2026
Merged

[OpenAPI] Improve missing query parameter error#9492
tobias-tengler merged 2 commits intomainfrom
tte/improve-missing-query-parameter-error

Conversation

@tobias-tengler
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 31, 2026 13:49
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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 DynamicEndpointMiddleware to throw a BadRequestException when 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.

@tobias-tengler tobias-tengler force-pushed the tte/improve-missing-query-parameter-error branch from 9344079 to 8da578a Compare March 31, 2026 14:04
@tobias-tengler tobias-tengler merged commit 797ccf1 into main Mar 31, 2026
128 checks passed
@tobias-tengler tobias-tengler deleted the tte/improve-missing-query-parameter-error branch March 31, 2026 14:23
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (d731a0c) to head (8da578a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9492   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants