1

I'm trying to add more information about one of my API routes using Swashbuckle. I only need to enable XML comments files in Swagger for one of my API routes. But, checking 'XML documentation file:' in Project -> Properties would force me to put XML comments throughout the whole project. Is there a way to achieve this?

For this I've included XML comments, made sure build's Output has the 'XML documentation file:' checked, and have

var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);

in my SwaggerConfig.cs.

zezz
  • 93
  • 2
  • 12
  • 1
    Turn off the warning in all the other source files. – Flydog57 Jul 11 '19 at 17:25
  • as far as i uderstood request: one approach : https://stackoverflow.com/questions/2875674/how-to-ignore-comments-when-reading-a-xml-file-into-a-xmldocument another one is use [ApiExplorerSettings(IgnoreApi = true)] – Power Mouse Jul 11 '19 at 17:32
  • @Flydog57 Thanks, that helped. – zezz Jul 11 '19 at 17:55

2 Answers2

0

use [ApiExplorerSettings(IgnoreApi = true)] on all controllers you want to remove from documentation

Power Mouse
  • 727
  • 6
  • 16
0

At this point, any classes or methods that are NOT annotated with XML comments will trigger a build warning. To suppress this, enter the warning code "1591" into the "Suppress warnings" field in the properties dialog or add 1591 to the section of your .csproj project file.

Niraj Trivedi
  • 2,370
  • 22
  • 24