F# codegen: HTTP route/query binding — string + typed (GH-2969)#2981
Merged
Conversation
Phase C long tail: teach ReadHttpFrame to emit F# for string binding to a
method argument — route values and query string.
- ReadHttpFrame.GenerateFSharpCode covers the string path:
- route value -> `let id = (httpContext.GetRouteValue("id") :?> string)`, with
the required-value 404 guard rendered as `if isNull id then (set 404; ())
else <rest of chain>` (F# has no early return, so Next renders in the else).
- query string -> `let q = httpContext.Request.Query.["q"].ToString()`.
- header/form string sources via the static ReadSingleHeaderValue / Form lookup.
- Parsed (non-string, out-var TryParse) binding and property/AsParameters binding
throw a clear NotSupportedException for now (deferred).
- Fixture: GET /things/{id} (route) and GET /search (query) render + compile.
fsharp-coverage with Wolverine.Http loaded: 29 implemented / 2 skipped /
50 remaining (ReadHttpFrame now implemented).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extends ReadHttpFrame's F# emit to parsed (non-string) binding for a method
argument, building on the string binding.
- writeParsedValueFSharp: F# auto-tuples the C# out-parameter TryParse into a
`match Type.TryParse(raw, InvariantCulture) with | true, v -> ... | _ -> ...`.
- Route value: null or parse-failure 404s + aborts; success binds the variable
and renders the rest of the chain in the success arm (no F# early return).
- Query/form/header: binds the parsed value or Unchecked.defaultof<T> on
failure, then continues.
- Nullable/optional and enum parsed binding still throw NotSupported (deferred).
- Fixture: GET /things/{id}/items/{count} (string + int route values) and
GET /paged?page= (int query) render + compile.
NOTE: this branch also carries the route/query *string* binding commit (PR #2980)
that merged into the stacked #2979 branch and never reached main; re-landing it
here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The fsharp workflow ran `dotnet test wolverine_fsharp.slnx`, which executes the
Core and Http gate test assemblies in parallel. Each gate shells a nested
`dotnet build` of its F# fixture, and both fixtures transitively build Debug
Wolverine.dll — concurrent nested builds raced on
obj/Debug/net9.0/refint/Wolverine.dll (MSB3883 / IOException "being used by
another process"), failing whichever gate lost the race.
- Run the two surface gates as separate, sequential `dotnet test` steps so their
nested fixture builds never overlap.
- Defense-in-depth: extend each gate's one-time retry to also cover the file-lock
signature ("being used by another process" / MSB3883), alongside the existing
FS0193 retry.
Verified: both gates pass when run sequentially.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 1, 2026
This was referenced Jul 6, 2026
This was referenced Jul 13, 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.
Extends
ReadHttpFrameF# emit to typed (parsed) HTTP binding for method arguments, on top of the string binding.Typed binding
writeParsedValueFSharp: F# auto-tuples the C#out-parameterTryParseintomatch Type.TryParse(raw, InvariantCulture) with | true, v -> … | _ -> ….Unchecked.defaultof<T>on failure, then continues.NotSupported(deferred).Generated F#
Verification
/things/{id}(string route),/search(string query),/things/{id}/items/{count}(string + int route),/paged(int query), plus the existing string/JSON endpoints.wolverine.slnxRelease regression — 0 warnings, 0 errors.Part of #2969.
🤖 Generated with Claude Code