Skip to content

[REQ] Add ability to differentiate between integer and int32 schemas #9447

@spacether

Description

@spacether

Is your feature request related to a problem? Please describe.

Our current java code cannot differentiate between these two use cases:

# int32 integer type: integer format: int32 # integer of unbounded size type: integer 

in classes that implement IJsonSchemaValidationProperties.

  • codegenProperty
  • codegenModel
  • codegenParameter
  • codegenResponse

Both schemas define this property as codegenProperty.isInteger
so we have no way of differentiating between the two above use cases.

Describe the solution you'd like

I would like two booleans to describe each of these use cases:

  • isUnboundedInteger
  • isShortInteger
    We can keep the existing isInteger property for existing generators.
    This way the addition will be a non-breaking change.

Describe alternatives you've considered

One could use isInteger as isUnboundedInteger but that would be a bad way to do it because our current code is using it for both isUnboundedInteger + isShortInteger

Better to make two new boolean fields which fully represent these formats.
These two new fields should be added to https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java

Additional context

This came up when working on imposing format constraints in
#8325

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions