🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / .Net Core Web Api / İsteklere açıklama ekleme Add comments to requests Annotations api request description

1-) .Net Core Web Api  - İsteklere açıklama ekleme Add comments to requests Annotations api request description

 

 

1- > yükle Install-Package Swashbuckle.AspNetCore.Annotations

 

2- FcmSendNetCoreApi.csproj aşağıdakini ekle

 

 <GenerateDocumentationFile>true</GenerateDocumentationFile>

 

aşağıdaki gibi

<Project Sdk="Microsoft.NET.Sdk.Web">

 

  <PropertyGroup>

     <GenerateDocumentationFile>true</GenerateDocumentationFile>

  </PropertyGroup>

 

</Project>

 

 

 

 

builder.Services.AddSwaggerGen();

 

builder.Services.AddSwaggerGen(options =>

{

    options.SwaggerDoc("v1", new OpenApiInfo

    {

        Version = "v2",

        Title = "ToDo API",

        Description = "ToDo API desc",

        TermsOfService = new Uri("https://example.com/terms"),

        Contact = new OpenApiContact

        {

            Name = "Example Contact",

            Url = new Uri("https://example.com/contact")

        },

        License = new OpenApiLicense

        {

            Name = "Example License",

            Url = new Uri("https://example.com/license")

        }

    });

 

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

    options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));

 

});

 

 

 

 

 

 /// <summary>

 /// Kırpma ve arka plan temizleme işlemleri.

 /// </summary>

 /// <param name="kirp">0 ise orijinal boyut, değilse kırpar.</param>

 /// <param name="removeBack">true ise siyah olmayan pikselleri siler.</param>

 /// <param name="siyahpixelOrani">0.1f - 0.5f arası bir oran.</param>

 /// <param name="cozOran">

 /// 0 demek Auto, şu değerlerden biri olabilir:

 /// <list type="bullet">

 /// <item>

 /// <description>Auto,</description>

 /// </item>

 /// <item>

 /// <description>4,</description>

 /// </item>

 /// <item>

 /// <description>2.5,</description>

 /// </item>

 /// <item>

 /// <description>2,</description>

 /// </item>

 /// <item>

 /// <description>1.5,</description>

 /// </item>

 /// <item>

 /// <description>1,</description>

 /// </item>

 /// <item>

 /// <description>0.5,</description>

 /// </item>

 /// <item>

 /// <description>0.25,</description>

 /// </item>

 /// </list>

 /// </param>

 /// <param name="removeBack">true ise siyah olmayan pikselleri siler.</param>

 [HttpPost]

 [Route("ocrBas64")]

 public ActionResult ocrBase64(OcrReq req)

 {

     var txt = imageApi.ocrBase64(req);

 

     return Ok(txt);

 

 }

 

 

 

builder.Services.AddSwaggerGen(c =>

{

    c.EnableAnnotations(); // Annotations'ı etkinleştir

});

 

 2024 Aralık 10 Salı
 452