-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
When controller functions are defined in a project reference rather than the target assembly (so they go through ParseXmlFile), doc strings are not added to the OpenApi output. Added this to models
project:
public static class ExtraApis
{
/// <summary>
/// No doc
/// </summary>
/// <param name="app"></param>
public static void MapExtraApis(this IEndpointRouteBuilder app)
{
var extraGroup = app.MapGroup("/api/extra");
extraGroup.MapGet("/test-xml-doc-comment", TextXmlDocComment);
}
/// <summary>
/// Test endpoint for xml doc comment
/// </summary>
/// <returns>A collection of todos for the specified project board.</returns>
/// <response code="200">Returns the list of todos.</response>
/// <response code="404">If the project board is not found.</response>
public static IResult TestXmlDocComment()
{
return Results.Ok();
}
}
It's exported to Models.xml
:
<?xml version="1.0"?>
<doc>
<assembly>
<name>Models</name>
</assembly>
<members>
[...]
<member name="M:ExtraApis.TestXmlDocComment">
<summary>
Test endpoint for xml doc comment
</summary>
<returns>A collection of todos for the specified project board.</returns>
<response code="200">Returns the list of todos.</response>
<response code="404">If the project board is not found.</response>
</member>
[...]
OpenApiXmlCommentSupport.generated.cs
has this XmlComment
entry:
cache.Add(@"M:ExtraApis.TestXmlDocComment", new XmlComment(@"Test endpoint for xml doc comment", null, null, @"A collection of todos for the specified project board.", null, false, null, null, [new XmlResponseComment(@"200", @"Returns the list of todos.", @""), new XmlResponseComment(@"404", @"If the project board is not found.", @"")]));
But CreateDocumentationId(MethodInfo)
returns:
methodInfo.CreateDocumentationId()
"M:ExtraApis.TestXmlDocComment~Microsoft.AspNetCore.Http.IResult"
Including the return type, which doesn't match Models.xml
.
Metadata
Metadata
Assignees
Labels
No labels