Skip to content

Commit

Permalink
Merge pull request #181 from swagger-api/issue-180
Browse files Browse the repository at this point in the history
updated versions, fixed test errors
  • Loading branch information
fehguy authored Dec 27, 2016
2 parents 6e1cb45 + ed82c4d commit 88dfa5b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 42 deletions.
29 changes: 2 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,6 @@
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>${swagger-core-version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
Expand Down Expand Up @@ -405,12 +391,6 @@
<version>${commons-io-version}</version>
</dependency>


<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
Expand All @@ -421,11 +401,6 @@
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
Expand Down Expand Up @@ -454,8 +429,8 @@
</dependency>
</dependencies>
<properties>
<swagger-core-version>1.5.10</swagger-core-version>
<swagger-parser-version>1.0.24-SNAPSHOT</swagger-parser-version>
<swagger-core-version>1.5.12</swagger-core-version>
<swagger-parser-version>1.0.25</swagger-parser-version>
<jackson.version>2.8.5</jackson.version>
<joda-time-version>2.2</joda-time-version>
<joda-version>1.2</joda-version>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/swagger/inflector/utils/ResolverUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ public Property createObjectProperty(Model model) {
property.setProperties(m.getProperties());
property.setName(m.getName());
property.setFormat(m.getFormat());
property.setDefault(m.getDefaultValue());
if(m.getDefaultValue() != null) {
property.setDefault(m.getDefaultValue().toString());
}
property.setDescription(m.getDescription());
property.setXml(m.getXml());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void validate(Object o, Parameter parameter, Iterator<Validator> chain) t
}
};
if(ap.getMaximum() != null) {
double max = ap.getMaximum();
double max = ap.getMaximum().doubleValue();
Double value;
try {
value = Double.parseDouble(o.toString());
Expand Down Expand Up @@ -55,7 +55,7 @@ public void validate(Object o, Parameter parameter, Iterator<Validator> chain) t
}
}
if(ap.getMinimum() != null) {
double min = ap.getMinimum();
double min = ap.getMinimum().doubleValue();
Double value;
try {
value = Double.parseDouble(o.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void testReadModel() throws Exception {
Object o = ExampleBuilder.fromProperty(new RefProperty("User"), definitions);

String str = new XmlExampleSerializer().serialize((Example) o);
assertEqualsIgnoreLineEnding(str, "<?xml version='1.1' encoding='UTF-8'?><user><id>0</id><user>string</user><child><childNames>string</childNames></child></user>");
assertEqualsIgnoreLineEnding(str, "<?xml version='1.1' encoding='UTF-8'?><user><id>0</id><user>string</user><children><child>string</child></children></user>");
}

@Test
Expand Down
23 changes: 12 additions & 11 deletions src/test/java/io/swagger/test/validators/NumericValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.math.BigDecimal;
import java.util.Arrays;

public class NumericValidatorTest {
Expand All @@ -40,7 +41,7 @@ public void setup() {
public void testValidIntegerMinimum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMinimum(10.0);
parameter.setMinimum(new BigDecimal("10.0"));

converter.validate(new Integer(11), parameter);
}
Expand All @@ -49,7 +50,7 @@ public void testValidIntegerMinimum() throws Exception {
public void testInvalidIntegerMinimum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMinimum(10.0);
parameter.setMinimum(new BigDecimal("10.0"));

converter.validate(new Integer(9), parameter);
}
Expand All @@ -58,7 +59,7 @@ public void testInvalidIntegerMinimum() throws Exception {
public void testEqualIntegerMinimum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMinimum(10.0);
parameter.setMinimum(new BigDecimal("10.0"));

converter.validate(new Integer(10), parameter);
}
Expand All @@ -67,7 +68,7 @@ public void testEqualIntegerMinimum() throws Exception {
public void testValidIntegerMaximum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10.0"));

converter.validate(new Integer(9), parameter);
}
Expand All @@ -76,7 +77,7 @@ public void testValidIntegerMaximum() throws Exception {
public void testInvalidIntegerMaximum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10.0"));

converter.validate(new Integer(11), parameter);
}
Expand All @@ -85,7 +86,7 @@ public void testInvalidIntegerMaximum() throws Exception {
public void testValidIntegerExclusiveMinimum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMinimum(10.0);
parameter.setMinimum(new BigDecimal("10.0"));
parameter.setExclusiveMinimum(true);

InputConverter.getInstance().validate(new Integer(11), parameter);
Expand All @@ -95,7 +96,7 @@ public void testValidIntegerExclusiveMinimum() throws Exception {
public void testInvalidIntegerExclusiveMinimumEquality() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMinimum(10.0);
parameter.setMinimum(new BigDecimal("10.0"));
parameter.setExclusiveMinimum(true);

InputConverter.getInstance().validate(new Integer(10), parameter);
Expand All @@ -105,7 +106,7 @@ public void testInvalidIntegerExclusiveMinimumEquality() throws Exception {
public void testValidIntegerExclusiveMaximum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10.0"));
parameter.setExclusiveMaximum(true);

InputConverter.getInstance().validate(new Integer(9), parameter);
Expand All @@ -115,7 +116,7 @@ public void testValidIntegerExclusiveMaximum() throws Exception {
public void testInvalidIntegerExclusiveMaximum() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10"));
parameter.setExclusiveMaximum(true);

InputConverter.getInstance().validate(new Integer(11), parameter);
Expand All @@ -125,7 +126,7 @@ public void testInvalidIntegerExclusiveMaximum() throws Exception {
public void testInvalidIntegerExclusiveMaximumEquality() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10.0"));
parameter.setExclusiveMaximum(true);

InputConverter.getInstance().validate(new Integer(10), parameter);
Expand All @@ -135,7 +136,7 @@ public void testInvalidIntegerExclusiveMaximumEquality() throws Exception {
public void testIssue127_b() throws Exception {
QueryParameter parameter = new QueryParameter()
.name("test");
parameter.setMaximum(10.0);
parameter.setMaximum(new BigDecimal("10.0"));
parameter.setExclusiveMaximum(true);

InputConverter.getInstance().validate("value 1", parameter);
Expand Down

0 comments on commit 88dfa5b

Please sign in to comment.