swagger-api / swagger-api/swagger-codegen-generators

Generated enum classes of type Integers faling to deserialize JSON using Jackson 2.10.x and higher version.

Open
#905 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

We detected an issue during the json deserialization using the Jackson library 2.11.2 version.

The enum classes generated with the swagger open API 3.0 generator plugin are causing Jackson to throw exception when trying to deserialize the json using Jackson library 2.10.x and above versions.

The issue is happening when a swagger yaml has a type declared with the enum type of Integer in the spec, and the generated code trying to deserialize the json.

I have created a PR #904 with a possible fix and tested it with different Java types on my machine. Kindly take a look and approve if you think it looks good.

sample yaml with an enum Integer:

Count:
type: Integer
enum:

  • 1
  • 2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PR #904 and the generated enum classes produced from the sample Swagger YAML. Reproduce JSON deserialization with Jackson 2.10 or later using the integer enum values 1 and 2, then verify that the generated code deserializes those values correctly across the Java types tested in the proposed fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.