Currently the parser ignores JsonKey(name) on enums.
This
enum Permission {
@JsonKey(name: "readonly")
READ_ONLY,
@JsonKey(name: "owner")
OWNER,
@JsonKey(name: "member")
MEMBER,
}
should generate:
const _$PermissionEnumMap = {
Permission.READ_ONLY: 'readonly',
Permission.OWNER: 'owner',
Permission.MEMBER: 'member',
};
but it generates:
const _$PermissionEnumMap = {
Permission.READ_ONLY: 'READ_ONLY',
Permission.OWNER: 'OWNER',
Permission.MEMBER: 'MEMBER',
};
Use @JsonValue for enums.
JsonValue supports strings and ints.
But yeah, this could print a warning that explains this at code generation time
Most helpful comment
Use @JsonValue for enums.
JsonValue supports strings and ints.
But yeah, this could print a warning that explains this at code generation time