is there any way to use xml comment on methods for swagger but without generating xml file?

22 views Asked by At

i have a project and im using this configuration for swagger and swagger documention

        public static void AddSwagger(this IServiceCollection services, string AssemblyName)
        {
            string releaseType = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
            if (releaseType != "Production")
            {
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new OpenApiInfo
                    {
                        //info
                    });

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

            }
        }

and this is how i comment on my methodes

        // GET: api/Article/ShowThumbnail/5
        /// <summary>Shows the thumbnail.</summary>
        /// <param name="id">The identifier.</param>
        /// <param name="width">The width.</param>
        /// <returns>
        ///   <br />
        /// </returns>
        [HttpGet]
        [Route("[action]/{id:int}/{width:int?}")]
        public async Task<IActionResult> ShowThumbnail(int id, int width = 100)
        {
            return await base.ShowThumbnail(id, width, ContentTypeEnum.Article);
        }

is there a way to use this type of comments without generating xml file? i want to delete this part of my SwaggerExtension

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

i remove xmlfilegenerator in csprojects and i dont want any warning in project

0

There are 0 answers