Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

385
Visualizações
Is it possible to show request body objects in the parameters section of Swagger UI?

I am using Swashbuckle with my .Net Core Web API project. I have some GET and POST requests, as usual.

Here's an example:

/// <summary>
/// Test request
/// </summary>
[HttpPost("Test")]
[Consumes("application/json")]
[Produces("application/json")]
[SwaggerResponse(200, "Request Executed", typeof(ResponseObject))]
public IActionResult Test([FromBody] TestObject t)
{
    var response = new ResponseObject
    {
        Id = t.Id,
        Name = t.Name,
    };

    return Content(response.JsonSerialize());
}

Used objects:

/// <summary>
/// An example object
/// </summary>
public class TestObject
{
    /// <summary>
    /// Object ID
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// Object name
    /// </summary>
    public string Name { get; set; }
}

/// <summary>
/// An example object
/// </summary>
public class ResponseObject
{
    /// <summary>
    /// Object ID
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// Object name
    /// </summary>
    public string Name { get; set; }
}

And here's the result: Text


What am I expecting to see is a deserialized object in "Parameters" section, as I saw in some other Swagger/Swashbuckle samples (Petstore, for example). Or, at least, something like in OpenAPI v2 specification with `c.SerializeAsV2 = true;`:

Text

So, the question is, is it possible to display a deserialized object in "Parameters" section?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Since you’re using an object & not query string parameters, TestObject’s properties won’t be displayed separately as an object is encapsulating.

Having separate fields are for query string parameters.

You can create custom Swagger layouts to display data however you’d like but I’d recommend to keep it as it is, to fall in line with common expectations of the Swagger UI.

Also feel free to have a combination of both; that would also work.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda