You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Nswag to generate a client API for a UserController, where UserDTO objects are defined as:
public class UserDTO
{
public int Id { get; set; }
public DateTime CreatedTime { get; private set; }
public DateTime UpdatedTime { get; private set; }
public string? UserName { get; set; }
public string? DisplayName { get; set; }
public string? EncodedPassword { get; set; }
public string? Email { get; set; }
public bool Active { get; set; }
public List? Roles { get; set; }
}
I would like to disallow clients to set created and update time by making the setters private. But the generated UserDTO on the client side still has a public setter. Are there any attributes to control the OpenAPI document generation in this respect?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using Nswag to generate a client API for a UserController, where UserDTO objects are defined as:
public class UserDTO
{
public int Id { get; set; }
public DateTime CreatedTime { get; private set; }
public DateTime UpdatedTime { get; private set; }
public string? UserName { get; set; }
public string? DisplayName { get; set; }
public string? EncodedPassword { get; set; }
public string? Email { get; set; }
public bool Active { get; set; }
public List? Roles { get; set; }
}
I would like to disallow clients to set created and update time by making the setters private. But the generated UserDTO on the client side still has a public setter. Are there any attributes to control the OpenAPI document generation in this respect?
Beta Was this translation helpful? Give feedback.
All reactions