api-client-generator
api-client-generator copied to clipboard
[models] add option to fill default field values
It would be awesome if the API client could generate constructor functions which would automatically fill null fields.
E.g:
interface User {
name: string;
email: string;
}
and the response from the API would be:
{
"email": "[email protected]"
}
the client would automatically migrate this model into:
{
"name": "",
"email": "[email protected]"
}
in user.model.ts
file there would be a function getUser
which will take User
as an optional parameter. It will return an empty user merged with the user provided in params