Jishan
Jishan

Reputation: 199

How to use custom action name with swagger in asp.net web api?

I am working on an asp.net web API project integrated with swagger.It works fine for conventional name(Get,Post,Put,Delete) but when i write an action with custom name not starting with those conventional name it's not showing in swagger.How to resolve this issue? Thanx in advance!

I already tried with different annotation but none of these are working.

[Route(Name = "CreateContact")] //not reflecting in swagger
[ActionName("CreateContact")] //not reflecting in swagger
[SwaggerOperation("CreateContact")] //not reflecting in swagger

Upvotes: 0

Views: 1235

Answers (1)

Jishan
Jishan

Reputation: 199

[Route("ActionName")] 

this resolved my issue. Thanks for help.Before the class name we can add [RoutePrefix("")]

Upvotes: 2

Related Questions