#2742: extract WolverineFx.Http.Newtonsoft package#2807
Merged
jeremydmiller merged 1 commit intoMay 14, 2026
Conversation
Removes the Newtonsoft.Json dependency from the core WolverineFx.Http NuGet package and moves the Newtonsoft HTTP surface to a new WolverineFx.Http.Newtonsoft companion package. Direct mirror of the core extraction in #2743 (WolverineFx -> WolverineFx.Newtonsoft). Per the issue: JsonUsage.NewtonsoftJson enum value stays in core; the extension package "registers" the codegen wiring at runtime via an internal INewtonsoftHttpCodeGen seam, and core throws a useful InvalidOperationException at codegen time if the enum is selected without the extension package installed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 18, 2026
Closed
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.
Wolverine 6.0 breaking change. Removes the Newtonsoft.Json dependency from the core
WolverineFx.HttpNuGet package and moves the Newtonsoft HTTP surface to a newWolverineFx.Http.Newtonsoftcompanion package — direct mirror of #2743 (which did the same extraction for the coreWolverineFxpackage).Closes #2742.
What moves
WolverineHttpOptions.UseNewtonsoftJsonForSerialization(...)WolverineFx.Http.NewtonsoftWolverine.Http.NewtonsoftHttpSerializationWolverine.Http.Newtonsoft.NewtonsoftHttpSerializationReadJsonBodyWithNewtonsoftcodegen frameWolverine.Http.Newtonsoft.CodeGen(internal)Migrate by:
dotnet add package WolverineFx.Http.Newtonsoftbuilder.Services.AddWolverineHttpNewtonsoft();alongsideAddWolverineHttp();using Wolverine.Http.Newtonsoft;wherever the old APIs are calledUseNewtonsoftJsonForSerializationitself doesn't changeWhat stays in core
Wolverine.HttpJsonUsageenum, includingJsonUsage.NewtonsoftJson. Per the issue's open question Replace project icon and website in Directory.Build.props #1, the enum stays public on core; selectingNewtonsoftJsonwithout the extension package installed throws anInvalidOperationExceptionat codegen time pointing the user atdotnet add package WolverineFx.Http.Newtonsoft.JsonResourceWriterPolicy/JsonBodyParameterStrategythat dispatch onJsonUsage. They route through a new internalINewtonsoftHttpCodeGenseam whenJsonUsage.NewtonsoftJsonis selected; the seam is implemented in the extension package.Branch points / decisions not pre-dictated by #2743
#2743 was an entirely-internal extraction (no public enum referenced the moved types). #2742 had to deal with
JsonUsage.NewtonsoftJsonbeing a public enum value on core that codegen branches on. Decisions made in this PR:AddWolverineHttp()registeredNewtonsoftHttpSerializationunconditionally as a singleton — an over-allocation paid by every app whether it used Newtonsoft or not. This PR removes that registration from core and ships anAddWolverineHttpNewtonsoft()extension onIServiceCollectionin the new package. Users opting in now make two calls (AddWolverineHttp().AddWolverineHttpNewtonsoft()) instead of one — explicit and pay-for-play.internal object?slot.UseNewtonsoftJsonForSerializationis called insideMapWolverineEndpoints(after the DI container is built), so the user'sAction<JsonSerializerSettings>callback can't be passed to the singleton at construction time directly. The extension stashes the callback on a newWolverineHttpOptions.NewtonsoftSettingsConfiguration(typed asobject?so core stays Newtonsoft-free), and the new package's singleton factory reads it back on first DI resolve.ProblemDetailsContinuationPolicy.WriteProblemsswitched from Newtonsoft to STJ. Symmetric to Wolverine 6.0: extract Newtonsoft.Json to WolverineFx.Newtonsoft package (BREAKING) #2743'sSubscription.Scopeswap (StringEnumConverter→JsonStringEnumConverter). This is a diagnostic-only log-line dump ofProblemDetails;ProblemDetailsround-trips cleanly through STJ. No observable output-format change.IsAotCompatible=true+ suppressions pattern fromWolverineFx.Newtonsoft(chunk AJ AOT chunk AJ: flip IsAotCompatible=true on Wolverine.Newtonsoft (#2746) #2801, merged). One namespace-scoped IL3050 suppression covering the codegenMakeGenericMethodpath; same justification as the parallel STJ branch in core Wolverine.Http.Transports / other extensions
No transport changes. Wolverine.Http.Marten / Wolverine.Http.FluentValidation build clean against the slimmer core. Tests in
Wolverine.Http.Testsget an explicitProjectReferenceto the new package and the one affected test (using_newtonsoft_for_serialization) gets itsusingdirective updated; no test logic changes.Test plan
WolverineFx.Http.Newtonsoftbuilds clean on net9.0 and net10.0 (0 warnings / 0 errors)WolverineFx.Httpbuilds clean on net9.0 and net10.0 with no Newtonsoft transitive dependencyWolverine.Http.Marten,Wolverine.Http.FluentValidationbuild cleanusing_newtonsoft_for_serialization.end_to_endend-to-end test — blocked locally by pre-existing AOT errors inWolverine.EntityFrameworkCore(the test project's transitive dep), unrelated to this PR; will fall out of CIDocumentation
docs/guide/http/json.md: replaced the inline Newtonsoft setup snippet with a "WolverineFx.Http.Newtonsoft" subsection that calls out the package install +AddWolverineHttpNewtonsoft()registration +using Wolverine.Http.Newtonsoft;directivedocs/guide/messages.md: cross-reference tip directing HTTP-serialization users to the HTTP-specific packagedocs/guide/migration.md: 3 new at-a-glance table rows + a full "Wolverine.Http Newtonsoft moved to WolverineFx.Http.Newtonsoft package (BREAKING)" section mirroring the prose pattern from Wolverine 6.0: extract Newtonsoft.Json to WolverineFx.Newtonsoft package (BREAKING) #2743's sectionBuild wiring
wolverine.slnx: newWolverine.Http.Newtonsoftproject added to the/Http/folderbuild/build.csnugetProjects:WolverineFx.Http.Newtonsoftadded to the pack list so it ships alongside coreWolverine.Http.csproj:PackageReference Newtonsoft.Jsonremoved; replaced with a pointer comment +InternalsVisibleTogrant forWolverine.Http.Newtonsoft(so the extension can call internalHttpGraph.UseNewtonsoftJson(INewtonsoftHttpCodeGen))Closes #2742; closes the Newtonsoft-extraction conversation from #2743 with the HTTP-side follow-up.
🤖 Generated with Claude Code