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