RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Swagger UI - display roles from AuthorizeAttribute #3088

Open oyvindi opened 3 years ago

oyvindi commented 3 years ago

Hi,

I would like to display the roles required for each endpoint in the Swagger-UI (from the [Authorize] attribute).

Is there a straight forward way to do this ?

RicoSuter commented 3 years ago

I dont know, you'd need to check out the Swagger UI docs and maybe we then need to expose the config in the UseSwaggerUi3 settings object... at least you should see the authorized operations with the lock symbol by default.

YvonneArnoldus commented 3 years ago

Hi,

I made a OperationProcessor to add the roles to description, that works for now.

IeuanWalker commented 10 months ago

@YvonneArnoldus can you share the code please