Reputation: 6684
I am using WebAPI Help pages project from nuget to document my ASP.Net WebAPI services.
I have several controllers that have the [Authorize] attribute and several custom Attributes.
What I have not been able to achieve is to have the Attributes added to the documentation.
So if a Controller is marked as [Authorize], then the documentation for the controller would say something like "This XYZ Controller requires Authorization"
So my question is how can I modify the WebAPI help code, to document the attributes on my Controllers.
Model level attributes are working with no issue.
Upvotes: 1
Views: 567
Reputation: 57949
You can modify the installed XmlDocumentationProvider.cs
at Areas\HelpPage\
for this. There modify the GetDocumentation(HttpControllerDescriptor controllerDescriptor)
method. You can inspect any attributes that are decorated no the controller type controllerDescriptor.ControllerType
and accordingly change the documentation.
When upgrading the HelpPage
nuget package you might find doing the above inconvenient as you might want to override the contents with latest bits...so instead you can create a custom documentation provider inheriting from XmlDocumentationProvider
and instead make a small modification to the installed HelpPageConfig.c
file and mention to your custom provider.
Upvotes: 3