OpenAPITools / OpenAPITools/openapi-generator

Java OpenApi generator Does not support for unsigned integer data type [Uint32]

Open
#11,087 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Java OpenApi generator Does not support for unsigned integer data type

openapi-generator version

4.3.1

OpenAPI declaration file content or url
Uint32:
  type: integer
  minimum: 0
  maximum: 4294967295 #(2^32)-1
Command line used for generation

Used the maven plugin to generate the model class from yaml file .

org.openapitools openapi-generator-maven-plugin 4.3.1
Steps to reproduce

Run open API code gen for the below value.

ChargingId:
$ref: '#/Uint32'

Uint32:
  type: integer
  minimum: 0
  maximum: 4294967295 #(2^32)-1

Its generating the below model class,

@ApiModelProperty(value = "")
@JsonProperty("ChargingId")
@Min(0) @Max(2147483647) public Integer getChargingId()

This is wrong as Integer does not hold 4294967295 value.

Related issues/PRs

NA

Suggest a fix/enhancement

Currenntly this is generating with Integer data type. Which have validation only for Integer.

Currenlt looks it doesn't not support Uint32 model class generation

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 reproducing the issue with the provided Uint32 schema through the openapi-generator Maven plugin and inspect the generated ChargingId model. Trace the Java generator's handling of integer bounds and validation annotations. Done means generated models represent the declared 0–4294967295 range without the incorrect Integer limit, with tests covering the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.