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
When updating my project to the .NET8 version, Newtonsfot.Json serialization stopped working. To solve this problem, I had to put a global variable in the Startup.cs class:
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum StatusEnum
{
/// <summary>
/// Enum AtivoEnum for Ativo
/// </summary>
[EnumMember(Value = "Ativo")]
AtivoEnum = 1,
/// <summary>
/// Enum UtilizadoEnum for Utilizado
/// </summary>
[EnumMember(Value = "Utilizado")]
UtilizadoEnum = 2,
/// <summary>
/// Enum CanceladoEnum for Cancelado
/// </summary>
[EnumMember(Value = "Cancelado")]
CanceladoEnum = 3
}
/// <summary>
/// Situação da recuperação da senha.
/// </summary>
/// <value>Situação da recuperação da senha.</value>
[DataMember(Name="Status")]
public StatusEnum? Status { get; set; }
For example, in the code above, when the Status object is serialized using the JSON format, the value of the "status" field is converted to the string "1" instead of the string "Ativo" like before.
The text was updated successfully, but these errors were encountered:
Description
When updating my project to the .NET8 version, Newtonsfot.Json serialization stopped working. To solve this problem, I had to put a global variable in the Startup.cs class:
Template aspnetcore used to enum
Swagger-codegen version
Last version
Swagger declaration file content or url
Code used exemple
For example, in the code above, when the Status object is serialized using the JSON format, the value of the "status" field is converted to the string "1" instead of the string "Ativo" like before.
The text was updated successfully, but these errors were encountered: