Fix missing ParameterDescriptor for form parameters in API descriptions#2587
Merged
jeremydmiller merged 2 commits intoJasperFx:mainfrom Apr 26, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a null-contract issue in Wolverine HTTP’s API description generation that can cause /openapi/v1.json to fail (HTTP 500) on ASP.NET Core 10 when endpoints use primitive [FromForm] parameters.
Changes:
- Populate
ApiParameterDescription.ParameterDescriptorfor form parameters emitted via_formValueVariablesinHttpChain.fillFormParameters. - Add a regression test asserting
ParameterDescriptoris present (and correctly populated) for a primitive[FromForm(Name = ...)]parameter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Http/Wolverine.Http/HttpChain.ApiDescription.cs | Ensures form ApiParameterDescription instances include a non-null ParameterDescriptor with Name and ParameterType. |
| src/Http/Wolverine.Http.Tests/using_form_parameters.cs | Adds a regression test validating ParameterDescriptor is set for primitive [FromForm] parameters used by OpenAPI form request-body generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
This was referenced Apr 28, 2026
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.
Summary
HttpChain.fillFormParametersemitsApiParameterDescriptioninstances without populatingParameterDescriptor. ASP.NET Core 10'sOpenApiDocumentService.GetFormRequestBodygroups form parameters byparameter.ParameterDescriptor.Namewith no null guard, so any application that contains a Wolverine HTTP endpoint with a primitive[FromForm]parameter (e.g.[FromForm] string,[FromForm] int,[FromForm] DateTime) returns HTTP 500 from/openapi/v1.json. The 500 takes down the entire OpenAPI document, breaking generated-client tooling (Orval, NSwag, Kiota, etc).The two sibling form-emit paths in the same file (the
FileParametersloop and theIFromFormMetadataloop) already populateParameterDescriptorwithnew ParameterDescriptor { Name, ParameterType }. This change extendsfillFormParametersto do the same._formValueVariablesis populated byTryFindOrCreateFormValue, called both directly from primitive[FromForm]parameters and indirectly fromFormBindingFramefor the constructor parameters of complex[FromForm]POCOs, so the fix covers both shapes.Why this scope
Narrow producer-side null-contract fix.
ApiParameterDescription.ParameterDescriptoris declared non-nullable inMicrosoft.AspNetCore.Mvc.Abstractions; producers should populate it.fillQuerystringParametersandfillKnownHeaderParametersalso leave it null, but query/header parameters don't flow throughGetFormRequestBodyand don't trigger the bug, so they're not changed here.Repro stack trace
Regression test
using_form_parameters.form_parameter_descriptions_have_a_parameter_descriptorexercises/form/explicit([FromForm(Name = "name")] string value), which routes through_formValueVariables→fillFormParameters. AssertsParameterDescriptoris non-null and carries the rightName+ParameterType.Fails on
main:Passes after the fix:
Test plan
mainusing_form_parametersclass: 29 passed, 8 pre-existing skipsopenapi/swashbuckle/open_apifilter: 35 passed, 0 failed