Generated swagger/redoc page doesn't respect inherited descriptions #48978
-
Consider writing an /// <summary>
/// Add user to database
/// </summary>
/// <param name="user">User to add</param>
/// <remarks>
///
/// Minimal request:
///
/// POST /users
/// { }
///
/// </remarks>
public Task<ActionResult<User>> PostUserAsync(User user); Implementing it method with all needed attributes works as expected, but the docs are not visible on swagger/redoc pages, even when I've also tried experimenting with writing sharable API in form of library/nuget package. Let's say it has a complete controller in this library: /// <summary>
/// User controller
/// </summary>
[ApiController]
[ApiConventionType(typeof(DefaultApiConventions))]
[Route("/users")]
public class UserController : ControllerBase
{
private readonly Context _context;
public UserController(Context context) => _context = context;
/// <summary>
/// Get user from database by id
/// </summary>
/// <param name="id">User's id</param>
/// <returns>User or response state</returns>
[HttpGet("{id}")]
[Produces(MediaTypeNames.Application.Json)]
public async Task<ActionResult<User>> GetUserAsync(int id)
{
var user = await Library.GetUserAsync(_context, id).ConfigureAwait(false);
if (user is null)
return BadRequest(new ProblemDetails { Detail = $"Object with id={id} doesn't exist" });
else
return Ok(user);
}
} Then, referencing this library from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I created #48982 -- let's discuss that over there. |
Beta Was this translation helpful? Give feedback.
I created #48982 -- let's discuss that over there.