How to build a dynamic minimal api with RequestDelegateFactory, and the api description can be shown in swagger ui #52718
Unanswered
AshWang-whm
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm facing a challenge that how can I create a dynamic api with [
RouteHandlerBuilder.MapMethods
] by RequestDelegate, and the api parameter and return type can be shown in swagger or how can I add customer metadata into [IApiDescriptionProvider
] ?Here is the code
WebApplication1.zip
there's two way to add dynamic api ,one is build a
Delegate
by object and bind theMethodInfo
, the swagger ui can display the Api Group and all the description , but the defect is it instance object look like useAddSingleton
, All dependencies use the singleton patterncreate the

Delegate
with instace!the other way is use
RequestDelegateFactory
, every thing is ok but the swagger can't display the api description, I don't konw how to add the metadata into the [IApiDescriptionProvider
].Beta Was this translation helpful? Give feedback.
All reactions