Skip to content

Does not obey JsonConverter on attribute that isn't part of a resource object #143

@BryanCrotaz

Description

@BryanCrotaz

Version 1.7.4:

A POJO with a nested JsonApi resource (User):

public class AuthenticationResponseDTO
{
    [JsonPropertyName("outcome")]
    [JsonConverter(typeof(JsonStringEnumConverter))]
    // AuthenticationOutcome  is an enum
    public AuthenticationOutcome Outcome { get; private set; }

    [JsonPropertyName("tokens")]
    public AuthenticationTokens? Tokens { get; private set; }

    [JsonPropertyName("tenant-permissions")]
    public Dictionary<string, List<string>> tenantPermissions { get; private set; }

    [JsonPropertyName("user")]
    public UserDTO? User { get; private set; }
}

Serializing this results in

{
  outcome: 0
  ...
  user: {data... }
}

Expected:

{
  outcome: "Authenticated"
  ...
  user: {data... }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions