Skip to content

Question: Enum, codegen and proguard #1147

@glureau-betclic

Description

@glureau-betclic

Trying to use an enum with Moshi-kotlin-codegen (1.9.2).

enum class LevelDto {
    @Json(name = "low") low,
    @Json(name = "high") high
}

This version is not safe for proguard, but I'm not sure if I should add a @Keep (or a proguard rule to preserve all enums) or a @JsonAdapter(generateAdapter = false). The only "documentation" that I found points to use the latter, but it's 2 years old so I'd have a confirmation if possible.

# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.

If it's still right, maybe editing the README.md could help future users?

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