Skip to content

Commit c671370

Browse files
Zomzogtduperron
authored andcommitted
isInteger as property
1 parent 2ea9fbe commit c671370

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class CodegenModel {
4444
public String defaultValue;
4545
public String arrayModelType;
4646
public boolean isAlias; // Is this effectively an alias of another simple type
47+
public boolean isInteger;
4748
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
4849
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
4950
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
@@ -74,10 +75,6 @@ public class CodegenModel {
7475
allMandatory = mandatory;
7576
}
7677

77-
public boolean isInteger(){
78-
return "Integer".equals(dataType);
79-
}
80-
8178
@Override
8279
public String toString() {
8380
return String.format("%s(%s)", name, classname);

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,9 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
15221522
if (ModelUtils.isMapSchema(schema)) {
15231523
addAdditionPropertiesToCodeGenModel(m, schema);
15241524
}
1525+
if (ModelUtils.isIntegerSchema(schema)) { // integer type
1526+
m.isInteger = Boolean.TRUE;
1527+
}
15251528
addVars(m, schema.getProperties(), schema.getRequired());
15261529
}
15271530

0 commit comments

Comments
 (0)