Skip to content

Swagger unable to document parameters on POST verb #118

@nitech

Description

@nitech

I set up a test implementation of CommunityToolkit.Datasync.Server and inspected the Swagger UI interface. I notice that GET, PUT and DELETE both document and work fine, but POST does not let me type the values Name and Operational of the Ship entity:

public class Ship : LiteDbTableData
{
    [Required]
    public string Name { get; set; } = string.Empty;
    public bool Operational { get; set; } = false;
}

image

I tested the POST method separately via Postman, and see it works fine. It seems Swagger is unable to auto generate the parameters because the Controller implements the TableController class of CommunityToolkit.Datasync.Server

[Route("tables/[controller]")]
public class ShipController : TableController<Ship>
{
    public ShipController(LiteDatabase db) : base(new LiteDbRepository<Ship>(db, "ships"))
    {
    }
}

I really would like to re-use the API for both the Avalonia Client and the Admin Website. As it stands I can do this, but the Swagger UI does not properly document the POST method.

When I POST via PostMan, I am able to invoke the POST verb, so I am quite confident the problem is introduced by the TableController somehow. Is there a way to make the Swagger UI document properly?

Metadata

Metadata

Assignees

Labels

ServerImprovements or additions to the server code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions