❔ POST request in swagger shows entire schema and parts of it are not needed in request body
I have a one to one relationship between Product and CartItem, in the POST request for Product the CartItem also shows but it's only there for the ef core relationship and not req body.
7 Replies
That's why you only ever return DTOs from the API, not database models
ok but in the controller how do I copy from DTO to model is there a special syntax for that? Thanks
Just do it manually, use an automapper, or create some helper methods for mapping
Ok thanks
Stack Overflow
Specify example requests for swagger's "Try it out"
Is there a way to specify example requests for swagger? Maybe even multiple ones?
The Try it out button shows only generic values like:
{
"firstName": "string",
"lastName": "string"
}
f...
you could also do this where it let's you specify example request bodies if that helps?
As someone who writes OData APIs I also sympathise with this struggle...
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.