@@ -76,51 +76,51 @@ function test(includeExampleData) {
76
76
{
77
77
input : '{"age": 46}' ,
78
78
expected :
79
- 'type AutoGenerated struct {\n\tAge int `json:"age"`\n}\n' ,
79
+ 'type AutoGenerated struct {\n\tAge int8 `json:"age"`\n}\n' ,
80
80
expectedWithExample :
81
- 'type AutoGenerated struct {\n\tAge int `json:"age" example:"46"`\n}\n' ,
81
+ 'type AutoGenerated struct {\n\tAge int8 `json:"age" example:"46"`\n}\n' ,
82
82
} ,
83
83
{
84
84
input : '{"negativeFloat": -1.00}' ,
85
85
expected :
86
- 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat"`\n}\n' ,
86
+ 'type AutoGenerated struct {\n\tNegativeFloat float32 `json:"negativeFloat"`\n}\n' ,
87
87
expectedWithExample :
88
- 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat" example:"-1.1"`\n}\n' ,
88
+ 'type AutoGenerated struct {\n\tNegativeFloat float32 `json:"negativeFloat" example:"-1.1"`\n}\n' ,
89
89
} ,
90
90
{
91
91
input : '{"zeroFloat": 0.00}' ,
92
92
expected :
93
- 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat"`\n}\n' ,
93
+ 'type AutoGenerated struct {\n\tZeroFloat float32 `json:"zeroFloat"`\n}\n' ,
94
94
expectedWithExample :
95
- 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat" example:"0.1"`\n}\n' ,
95
+ 'type AutoGenerated struct {\n\tZeroFloat float32 `json:"zeroFloat" example:"0.1"`\n}\n' ,
96
96
} ,
97
97
{
98
98
input : '{"positiveFloat": 1.00}' ,
99
99
expected :
100
- 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat"`\n}\n' ,
100
+ 'type AutoGenerated struct {\n\tPositiveFloat float32 `json:"positiveFloat"`\n}\n' ,
101
101
expectedWithExample :
102
- 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat" example:"1.1"`\n}\n' ,
102
+ 'type AutoGenerated struct {\n\tPositiveFloat float32 `json:"positiveFloat" example:"1.1"`\n}\n' ,
103
103
} ,
104
104
{
105
105
input : '{"negativeFloats": [-1.00, -2.00, -3.00]}' ,
106
106
expected :
107
- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
107
+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
108
108
expectedWithExample :
109
- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
109
+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
110
110
} ,
111
111
{
112
112
input : '{"zeroFloats": [0.00, 0.00, 0.00]}' ,
113
113
expected :
114
- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
114
+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
115
115
expectedWithExample :
116
- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
116
+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
117
117
} ,
118
118
{
119
119
input : '{"positiveFloats": [1.00, 2.00, 3.00]}' ,
120
120
expected :
121
- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
121
+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
122
122
expectedWithExample :
123
- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
123
+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
124
124
} ,
125
125
{
126
126
input : '{"topLevel": { "secondLevel": "exampleDataHere"} }' ,
@@ -162,6 +162,7 @@ function testFiles() {
162
162
const testCases = [
163
163
"duplicate-top-level-structs" ,
164
164
"double-nested-objects" ,
165
+ "supported-number-types" ,
165
166
] ;
166
167
167
168
for ( const testCase of testCases ) {
0 commit comments