Skip to content

Commit 321dc0d

Browse files
committed
add test case for number (decimal)
1 parent fa3aacf commit 321dc0d

File tree

10 files changed

+311
-0
lines changed

10 files changed

+311
-0
lines changed

modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,27 @@ definitions:
10051005
type: array
10061006
items:
10071007
$ref: '#/definitions/ReadOnlyFirst'
1008+
NumberOnly:
1009+
type: object
1010+
properties:
1011+
JustNumber:
1012+
type: number
1013+
ArrayOfNumberOnly:
1014+
type: object
1015+
properties:
1016+
ArrayNumber:
1017+
type: array
1018+
items:
1019+
type: number
1020+
ArrayOfArrayOfNumberOnly:
1021+
type: object
1022+
properties:
1023+
ArrayArrayNumber:
1024+
type: array
1025+
items:
1026+
type: array
1027+
items:
1028+
type: number
10081029
externalDocs:
10091030
description: Find out more about Swagger
10101031
url: 'http://swagger.io'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
language: java
17+
jdk:
18+
- oraclejdk8
19+
- oraclejdk7
20+
before_install:
21+
# ensure gradlew has proper permission
22+
- chmod a+x ./gradlew
23+
script:
24+
# test using maven
25+
- mvn test
26+
# uncomment below to test using gradle
27+
# - gradle test
28+
# uncomment below to test using sbt
29+
# - sbt test
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# ArrayOfArrayOfNumberOnly
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional]
8+
9+
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# ArrayOfNumberOnly
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional]
8+
9+
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# NumberOnly
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
8+
9+
10+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world!
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package io.swagger.client.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
import java.util.Objects;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import io.swagger.annotations.ApiModel;
7+
import io.swagger.annotations.ApiModelProperty;
8+
import java.math.BigDecimal;
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
12+
13+
/**
14+
* ArrayOfArrayOfNumberOnly
15+
*/
16+
17+
public class ArrayOfArrayOfNumberOnly {
18+
19+
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>();
20+
21+
22+
/**
23+
**/
24+
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
25+
this.arrayArrayNumber = arrayArrayNumber;
26+
return this;
27+
}
28+
29+
@ApiModelProperty(example = "null", value = "")
30+
@JsonProperty("ArrayArrayNumber")
31+
public List<List<BigDecimal>> getArrayArrayNumber() {
32+
return arrayArrayNumber;
33+
}
34+
public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
35+
this.arrayArrayNumber = arrayArrayNumber;
36+
}
37+
38+
39+
@Override
40+
public boolean equals(java.lang.Object o) {
41+
if (this == o) {
42+
return true;
43+
}
44+
if (o == null || getClass() != o.getClass()) {
45+
return false;
46+
}
47+
ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o;
48+
return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber);
49+
}
50+
51+
@Override
52+
public int hashCode() {
53+
return Objects.hash(arrayArrayNumber);
54+
}
55+
56+
@Override
57+
public String toString() {
58+
StringBuilder sb = new StringBuilder();
59+
sb.append("class ArrayOfArrayOfNumberOnly {\n");
60+
61+
sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n");
62+
sb.append("}");
63+
return sb.toString();
64+
}
65+
66+
/**
67+
* Convert the given object to string with each line indented by 4 spaces
68+
* (except the first line).
69+
*/
70+
private String toIndentedString(java.lang.Object o) {
71+
if (o == null) {
72+
return "null";
73+
}
74+
return o.toString().replace("\n", "\n ");
75+
}
76+
}
77+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package io.swagger.client.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
import java.util.Objects;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import io.swagger.annotations.ApiModel;
7+
import io.swagger.annotations.ApiModelProperty;
8+
import java.math.BigDecimal;
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
12+
13+
/**
14+
* ArrayOfNumberOnly
15+
*/
16+
17+
public class ArrayOfNumberOnly {
18+
19+
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>();
20+
21+
22+
/**
23+
**/
24+
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
25+
this.arrayNumber = arrayNumber;
26+
return this;
27+
}
28+
29+
@ApiModelProperty(example = "null", value = "")
30+
@JsonProperty("ArrayNumber")
31+
public List<BigDecimal> getArrayNumber() {
32+
return arrayNumber;
33+
}
34+
public void setArrayNumber(List<BigDecimal> arrayNumber) {
35+
this.arrayNumber = arrayNumber;
36+
}
37+
38+
39+
@Override
40+
public boolean equals(java.lang.Object o) {
41+
if (this == o) {
42+
return true;
43+
}
44+
if (o == null || getClass() != o.getClass()) {
45+
return false;
46+
}
47+
ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o;
48+
return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber);
49+
}
50+
51+
@Override
52+
public int hashCode() {
53+
return Objects.hash(arrayNumber);
54+
}
55+
56+
@Override
57+
public String toString() {
58+
StringBuilder sb = new StringBuilder();
59+
sb.append("class ArrayOfNumberOnly {\n");
60+
61+
sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n");
62+
sb.append("}");
63+
return sb.toString();
64+
}
65+
66+
/**
67+
* Convert the given object to string with each line indented by 4 spaces
68+
* (except the first line).
69+
*/
70+
private String toIndentedString(java.lang.Object o) {
71+
if (o == null) {
72+
return "null";
73+
}
74+
return o.toString().replace("\n", "\n ");
75+
}
76+
}
77+

samples/client/petstore/java/default/src/main/java/io/swagger/client/model/ArrayTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.fasterxml.jackson.annotation.JsonProperty;
66
import io.swagger.annotations.ApiModel;
77
import io.swagger.annotations.ApiModelProperty;
8+
import io.swagger.client.model.ReadOnlyFirst;
89
import java.util.ArrayList;
910
import java.util.List;
1011

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package io.swagger.client.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
import java.util.Objects;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import io.swagger.annotations.ApiModel;
7+
import io.swagger.annotations.ApiModelProperty;
8+
import java.math.BigDecimal;
9+
10+
11+
/**
12+
* NumberOnly
13+
*/
14+
15+
public class NumberOnly {
16+
17+
private BigDecimal justNumber = null;
18+
19+
20+
/**
21+
**/
22+
public NumberOnly justNumber(BigDecimal justNumber) {
23+
this.justNumber = justNumber;
24+
return this;
25+
}
26+
27+
@ApiModelProperty(example = "null", value = "")
28+
@JsonProperty("JustNumber")
29+
public BigDecimal getJustNumber() {
30+
return justNumber;
31+
}
32+
public void setJustNumber(BigDecimal justNumber) {
33+
this.justNumber = justNumber;
34+
}
35+
36+
37+
@Override
38+
public boolean equals(java.lang.Object o) {
39+
if (this == o) {
40+
return true;
41+
}
42+
if (o == null || getClass() != o.getClass()) {
43+
return false;
44+
}
45+
NumberOnly numberOnly = (NumberOnly) o;
46+
return Objects.equals(this.justNumber, numberOnly.justNumber);
47+
}
48+
49+
@Override
50+
public int hashCode() {
51+
return Objects.hash(justNumber);
52+
}
53+
54+
@Override
55+
public String toString() {
56+
StringBuilder sb = new StringBuilder();
57+
sb.append("class NumberOnly {\n");
58+
59+
sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n");
60+
sb.append("}");
61+
return sb.toString();
62+
}
63+
64+
/**
65+
* Convert the given object to string with each line indented by 4 spaces
66+
* (except the first line).
67+
*/
68+
private String toIndentedString(java.lang.Object o) {
69+
if (o == null) {
70+
return "null";
71+
}
72+
return o.toString().replace("\n", "\n ");
73+
}
74+
}
75+

0 commit comments

Comments
 (0)