Skip to content

Enum as Object issues #140

Closed
Closed
@haynesgt

Description

@haynesgt

I have enums that are annotated with @JsonFormat(shape= JsonFormat.Shape.OBJECT

My enums are like this:

@JsonFormat(shape= JsonFormat.Shape.OBJECT)
public enum StatusType {
        GOOD(0, "Good"),
        FULL(1, "Full");
        private int code;
        private String label;
        private StatusType(int code, String label) {
            this.label = label;
            this.code = code;
        }
	public int getCode() { return code; }
	public String getLabel() { return label; }
}

In the HTTP response they look like this:

{
    code: 0,
    label: "GOOD"
}

However, my generated Typescript looks like this:

    export type StatusType = "GOOD" | "FULL";

Also, excluding the class does not work. StatusType is still there.

I'm looking for a workaround right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions