Repository navigation
Conversation
ThinktectureSchemaFilter and ThinktectureParameterFilter are created inside the SwaggerGenOptions configuration of AddThinktectureOpenApiFilters. Their constructors resolved ISerializerDataContractResolver to detect Swashbuckle.AspNetCore.Newtonsoft. Since Swashbuckle 10.3.0 the default resolver is built from SchemaGeneratorOptions, which are configured from SwaggerGenOptions. Resolving it during that configuration re-enters it, so building the OpenAPI document recurses endlessly and hangs (e.g. dotnet-getdocument times out at build time). Detect the resolver lazily on first use instead.
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.
With Swashbuckle.AspNetCore 10.3.0, generating the OpenAPI document hangs as soon as
AddThinktectureOpenApiFiltersis registered (dotnet-getdocumenttimes out at build time).Cause:
ThinktectureSchemaFilter/ThinktectureParameterFilterare created inside theSwaggerGenOptionsconfiguration and resolveISerializerDataContractResolverin their constructors. Since domaindrivendev/Swashbuckle.AspNetCore#3998 the default resolver is built fromSchemaGeneratorOptions, whoseConfigureSchemaGeneratorOptionsdepends onIOptions<SwaggerGenOptions>, so the configuration re-enters itself endlessly.Fix: detect the Newtonsoft resolver lazily on first
Apply. Behavior with Swashbuckle 10.1.0 is unchanged; a regression test mirrors the 10.3 registration.Heads-up, not part of this PR: bumping the tests to 10.3.0 changes two snapshots (
*_with_string_enum_converter_as_body_parameter). Swashbuckle no longer readsMvc.JsonOptionswhen MVC isn't registered (domaindrivendev/Swashbuckle.AspNetCore#4116), whileJsonSerializerOptionsResolverstill does.