swagger-api / swagger-api/swagger-core
Jackson @JsonFormat doesn't support Enum type
Open
Nobody has claimed this yet.
backlog
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Same Issue on: #3691
ModelResolve doesn't support @JsonFormat
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum User {
FOO(1, "Foo"),
BAR(2, "Bar");
User(int id, String name) {
this.id = id;
this.name = name;
}
@JsonProperty("id")
public int id;
@JsonProperty("name")
public String name;
}
expect
"User" : {
"properties" : {
"id" : {
"format" : "int32",
"type" : "integer"
},
"name" : {
"type" : "string"
}
},
"type" : "object"
}
Serialize
"user" : {
"enum" : [ "FOO", "BAR" ],
"type" : "string"
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ModelResolve path mentioned in the issue and reproduce the annotated enum example. Compare the generated model with the expected object schema and the serialized enum output. Done means @JsonFormat(shape = OBJECT) is reflected correctly for enum model resolution without regressing serialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100