ameya
ameya

Reputation: 1668

Swagger 3.0 ASP.NET Core - How to add documentation for Model Schema in request Body and Response

I have the model schema for the REST API body and in response. The XML comments have been defined but I cannot figure out a way to include the XML documentation for the model schema in Swagger UI 3.0 both in API body and in response ?

enter image description here

Upvotes: 0

Views: 1715

Answers (1)

ameya
ameya

Reputation: 1668

I missed this, it works now. I had the schemas spread over different asp.net core assemblies and Swagger UI 3.0 does support adding multiple XML sources.

To include the controller comments itself we have to set includeControllerXmlComments: true

c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test1.xml"), includeControllerXmlComments: true);
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test2.xml"), includeControllerXmlComments: true);
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "test3.xml"), includeControllerXmlComments: true);

Upvotes: 1

Related Questions