I'm designing a Web API and I've enabled Swagger on it.
My Create
and Update
operations share the same entity. I'm not using DTOs, but the actual Model.
class Person
{
public int Id { get; set; }
public string Name { get; set }
}
The problem is that doing this way, the Create operation is confusing to the consumers of the API, because Swagger states that accepts an Id
, while it should not. In fact, it should be shown in the Sample data.
Is there a good an easy way to avoid using DTOs (I hate mapping) while keeping the API free of this confusion?