I am using fast-endpoints library for building a minimal API. I need to have two generic headers (name, tracking-Id) across all methods of all the resources.
To implement this requirement, I have used a custom implementation of IGlobalPreProcessor
which checks if the incoming requests have these headers. It sends out a validation failure message if the headers are not present.
However on the swagger page, I don't see these two headers. I need help to add these two headers on swagger.
I have tried to implement IOperationProcessor
, but not sure how to use it with fast-endpoints as
builder.services.AddOpenApiDocument()
is called inside fast-endpoints extension builder.Services.SwaggerDocument()
you can register an
IOperationProcessor
like this with FastEndpoints:and here's an example processor that adds a custom header to the swagger doc globally: