Skip to content

Commit

Permalink
add multipleOf to CodegenProperty (OpenAPITools#2192)
Browse files Browse the repository at this point in the history
  • Loading branch information
yasammez committed Jan 14, 2020
1 parent cbc1254 commit e3ca3a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public String jsonSchema;
public String minimum;
public String maximum;
public Number multipleOf;
public boolean exclusiveMinimum;
public boolean exclusiveMaximum;
public boolean hasMore;
Expand Down Expand Up @@ -513,6 +514,14 @@ public void setMaxProperties(Integer maxProperties) {
this.maxProperties = maxProperties;
}

public Number getMultipleOf() {
return multipleOf;
}

public void setMultipleOf(Number multipleOf) {
this.multipleOf = multipleOf;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
Expand Down Expand Up @@ -591,6 +600,7 @@ public String toString() {
sb.append(", maxProperties=").append(maxProperties);
sb.append(", minProperties=").append(minProperties);
sb.append(", uniqueItems=").append(uniqueItems);
sb.append(", multipleOf=").append(multipleOf);
sb.append(", isXmlAttribute=").append(isXmlAttribute);
sb.append(", xmlPrefix='").append(xmlPrefix).append('\'');
sb.append(", xmlName='").append(xmlName).append('\'');
Expand Down Expand Up @@ -681,7 +691,8 @@ public boolean equals(Object o) {
Objects.equals(minItems, that.minItems) &&
Objects.equals(xmlPrefix, that.xmlPrefix) &&
Objects.equals(xmlName, that.xmlName) &&
Objects.equals(xmlNamespace, that.xmlNamespace);
Objects.equals(xmlNamespace, that.xmlNamespace) &&
Objects.equals(multipleOf, that.multipleOf);
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,9 @@ public CodegenProperty fromProperty(String name, Schema p) {
if (p.getExclusiveMaximum() != null) {
property.exclusiveMaximum = p.getExclusiveMaximum();
}
if (p.getMultipleOf() != null) {
property.multipleOf = p.getMultipleOf();
}

// check if any validation rule defined
// exclusive* are noop without corresponding min/max
Expand Down

0 comments on commit e3ca3a2

Please sign in to comment.