@@ -76,51 +76,51 @@ function test(includeExampleData) {
7676 {
7777 input : '{"age": 46}' ,
7878 expected :
79- 'type AutoGenerated struct {\n\tAge int `json:"age"`\n}\n' ,
79+ 'type AutoGenerated struct {\n\tAge int8 `json:"age"`\n}\n' ,
8080 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' ,
8282 } ,
8383 {
8484 input : '{"negativeFloat": -1.00}' ,
8585 expected :
86- 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat"`\n}\n' ,
86+ 'type AutoGenerated struct {\n\tNegativeFloat float32 `json:"negativeFloat"`\n}\n' ,
8787 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' ,
8989 } ,
9090 {
9191 input : '{"zeroFloat": 0.00}' ,
9292 expected :
93- 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat"`\n}\n' ,
93+ 'type AutoGenerated struct {\n\tZeroFloat float32 `json:"zeroFloat"`\n}\n' ,
9494 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' ,
9696 } ,
9797 {
9898 input : '{"positiveFloat": 1.00}' ,
9999 expected :
100- 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat"`\n}\n' ,
100+ 'type AutoGenerated struct {\n\tPositiveFloat float32 `json:"positiveFloat"`\n}\n' ,
101101 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' ,
103103 } ,
104104 {
105105 input : '{"negativeFloats": [-1.00, -2.00, -3.00]}' ,
106106 expected :
107- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
107+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
108108 expectedWithExample :
109- 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}\n' ,
109+ 'type AutoGenerated struct {\n\tNegativeFloats []float32 `json:"negativeFloats"`\n}\n' ,
110110 } ,
111111 {
112112 input : '{"zeroFloats": [0.00, 0.00, 0.00]}' ,
113113 expected :
114- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
114+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
115115 expectedWithExample :
116- 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}\n' ,
116+ 'type AutoGenerated struct {\n\tZeroFloats []float32 `json:"zeroFloats"`\n}\n' ,
117117 } ,
118118 {
119119 input : '{"positiveFloats": [1.00, 2.00, 3.00]}' ,
120120 expected :
121- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
121+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
122122 expectedWithExample :
123- 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}\n' ,
123+ 'type AutoGenerated struct {\n\tPositiveFloats []float32 `json:"positiveFloats"`\n}\n' ,
124124 } ,
125125 {
126126 input : '{"topLevel": { "secondLevel": "exampleDataHere"} }' ,
@@ -162,6 +162,7 @@ function testFiles() {
162162 const testCases = [
163163 "duplicate-top-level-structs" ,
164164 "double-nested-objects" ,
165+ "supported-number-types" ,
165166 ] ;
166167
167168 for ( const testCase of testCases ) {
0 commit comments