@@ -1815,12 +1815,23 @@ protected void processPropertySchemaContainerTypes(CodegenProperty codegenProper
18151815 }
18161816
18171817 private void handleMinMaxValues (Schema propertySchema , CodegenProperty codegenProperty ) {
1818- if (propertySchema .getMinimum () != null ) {
1819- codegenProperty .minimum = String .valueOf (propertySchema .getMinimum ().longValue ());
1820- }
1821- if (propertySchema .getMaximum () != null ) {
1822- codegenProperty .maximum = String .valueOf (propertySchema .getMaximum ().longValue ());
1823- }
1818+ if (propertySchema .getMaximum () != null ) {
1819+ long maximumLongValue = propertySchema .getMaximum ().longValue ();
1820+ if (maximumLongValue > Integer .MAX_VALUE || maximumLongValue < Integer .MIN_VALUE ) {
1821+ codegenProperty .maximum = String .valueOf (propertySchema .getMaximum ().longValue ()) + "L" ;
1822+ } else {
1823+ codegenProperty .maximum = String .valueOf (propertySchema .getMaximum ().longValue ());
1824+ }
1825+ }
1826+ if (propertySchema .getMinimum () != null ) {
1827+ long minimumLongValue = propertySchema .getMinimum ().longValue ();
1828+ if (minimumLongValue > Integer .MAX_VALUE || minimumLongValue < Integer .MIN_VALUE ) {
1829+ codegenProperty .minimum = String .valueOf (propertySchema .getMinimum ().longValue ()) + "L" ;
1830+ } else {
1831+ codegenProperty .minimum = String .valueOf (propertySchema .getMinimum ().longValue ());
1832+ }
1833+ }
1834+
18241835 if (propertySchema .getExclusiveMinimum () != null ) {
18251836 codegenProperty .exclusiveMinimum = propertySchema .getExclusiveMinimum ();
18261837 }
@@ -2582,8 +2593,26 @@ public CodegenParameter fromParameter(Parameter parameter, Set<String> imports)
25822593 // validation
25832594 // handle maximum, minimum properly for int/long by removing the trailing ".0"
25842595 if (parameterSchema instanceof IntegerSchema ) {
2585- codegenParameter .maximum = parameterSchema .getMaximum () == null ? null : String .valueOf (parameterSchema .getMaximum ().longValue ());
2586- codegenParameter .minimum = parameterSchema .getMinimum () == null ? null : String .valueOf (parameterSchema .getMinimum ().longValue ());
2596+ if (parameterSchema .getMaximum () == null ) {
2597+ codegenParameter .maximum = null ;
2598+ } else {
2599+ long maximumLongValue = parameterSchema .getMaximum ().longValue ();
2600+ if (maximumLongValue > Integer .MAX_VALUE || maximumLongValue < Integer .MIN_VALUE ) {
2601+ codegenParameter .maximum = String .valueOf (parameterSchema .getMaximum ().longValue ()) + "L" ;
2602+ } else {
2603+ codegenParameter .maximum = String .valueOf (parameterSchema .getMaximum ().longValue ());
2604+ }
2605+ }
2606+ if (parameterSchema .getMinimum () == null ) {
2607+ codegenParameter .minimum = null ;
2608+ } else {
2609+ long minimumLongValue = parameterSchema .getMinimum ().longValue ();
2610+ if (minimumLongValue > Integer .MAX_VALUE || minimumLongValue < Integer .MIN_VALUE ) {
2611+ codegenParameter .minimum = String .valueOf (parameterSchema .getMinimum ().longValue ()) + "L" ;
2612+ } else {
2613+ codegenParameter .minimum = String .valueOf (parameterSchema .getMinimum ().longValue ());
2614+ }
2615+ }
25872616 } else {
25882617 codegenParameter .maximum = parameterSchema .getMaximum () == null ? null : String .valueOf (parameterSchema .getMaximum ());
25892618 codegenParameter .minimum = parameterSchema .getMinimum () == null ? null : String .valueOf (parameterSchema .getMinimum ());
0 commit comments