Forum Discussion

bassameter's avatar
bassameter
New Member
2 years ago

comments path for the Swagger from cloud file

Hello,

builder.Services.AddSwaggerGen(c =>

{

    // Set the comments path for the Swagger JSON and UI.

    var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";

    var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);

    c.IncludeXmlComments(xmlPath, includeControllerXmlComments: true);

    …

}

in my program.cs (.Net 6) this enables Swagger to get XML comments from local file/

By writing the following:

builder.Services.AddSwaggerGen(c =>

{

    // Set the comments Cloud path for the Swagger JSON and UI.

    var xmlPath = @"https://1drv.ms/u/s!ArbyNiHSertgFhGDabdiwUaeH7vD?e=PesGV8";

    c.IncludeXmlComments(xmlPath, includeControllerXmlComments: true);

    …

}

I thought I could tell Swagger to get XML comments from a shared file on Google drive for example. But It doesn't work, because it's a link, not a file path.

Is there a way to let Swagger populate XML documentation for APIs from a file on the cloud?

Thanks.

No RepliesBe the first to reply