第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

在aspnet core 2.1中生成Swashbuckle實(shí)現(xiàn)筆記

在aspnet core 2.1中生成Swashbuckle實(shí)現(xiàn)筆記

C#
紫衣仙女 2021-12-05 14:54:38
我正在使用 Swashbuckle 生成 swagger 文檔。不幸的是,我找不到如何根據(jù)附加圖片添加實(shí)施說明。Bellow 是從我的代碼中摘錄來生成一些標(biāo)簽的。/// <summary>    /// User login for given application    /// </summary>    /// <description>    /// Test description    /// </description>    /// <remarks>    /// Sample request:    ///     ///     POST /login    ///     {    ///         "email": "jon@nighwatch.com",    ///         "password": "jonLov3sDaenarys"    ///         "productId": "5e7en-k1ngd0m5"    ///     }    ///         /// </remarks>    /// <param name="model">Login model</param>    /// <returns>JWT Token</returns>    /// <response code="200">Returns the newly created auth response, containing token with user information</response>    /// <response code="400">If the request is invalid or productId doesn't exist</response>    /// <response code="403">If the account is locked out or role is inactive</response>    [HttpPost]    [Produces("application/json")]    [Consumes("application/json")]    [ProducesResponseType(typeof(AuthResponseModel), 200)]    [ProducesResponseType(400)]    [ProducesResponseType(403)]    [Route("login")]    public async Task<IActionResult> Login([FromBody]LoginModel model)    {        if (ModelState.IsValid)        {知道我做錯(cuò)了什么嗎?
查看完整描述

2 回答

?
慕田峪7331174

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊

您必須生成 XML 文檔文件。


項(xiàng)目屬性>構(gòu)建>輸出=> 檢查XML Documentation file。例子:bin\netcoreapp2.1\MyProject.xml


在 中ConfigureServices,您所做的services.AddSwaggerGen(...)包括生成的文件:


services.AddSwaggerGen(options =>

            {

                var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MyProject.xml");

                options.IncludeXmlComments(filePath);

            });

如果這兩件事都到位,則應(yīng)該在文檔中包含 xml 注釋。


查看完整回答
反對(duì) 回復(fù) 2021-12-05
?
守候你守候我

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊

您是否錯(cuò)過了 swagger 的屬性?

    [SwaggerOperation("Get_Whatever")]
    [SwaggerResponse(StatusCodes.Status200OK, typeof(List<string>), "An array of strings.")]
    [SwaggerResponse(StatusCodes.Status403Forbidden, null, "Forbidden")]    public async Task<IActionResult> Login([FromBody]LoginModel model){


查看完整回答
反對(duì) 回復(fù) 2021-12-05
  • 2 回答
  • 0 關(guān)注
  • 229 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)