简体   繁体   中英

NSwag change controller description

I want to change controller description of NSwag UI in .Net Core. I am using latest version (13.8.1). How to achieve this?

在此处输入图片说明

From the image above, I want to rename the title RefUserLocation to User Location . But doesn't change the endpoint itself where users are still able to access to api/refuserlocation

Add [OpenApiTag("RenameName")] to your controller like below:

using NSwag.Annotations;

[Route("api/[controller]")]
[ApiController]
[OpenApiTag("User Location")]
public class RefUserLocationController : ControllerBase
{...}

Result: 在此处输入图片说明

Note:

I use NSwag.AspNetCore version 13.8.2 .So the SwaggerTag is obsolete,if you used the older version of nswag,you could use [SwaggerTag("User Location")] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM