@@ -78,6 +78,48 @@ function test(includeExampleData) {
78
78
expectedWithExample :
79
79
'type AutoGenerated struct {\n\tAge int `json:"age" example:"46"`\n}'
80
80
} ,
81
+ {
82
+ input : '{"negativeFloat": -1.00}' ,
83
+ expected :
84
+ 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat"`\n}' ,
85
+ expectedWithExample :
86
+ 'type AutoGenerated struct {\n\tNegativeFloat float64 `json:"negativeFloat" example:"-1.1"`\n}'
87
+ } ,
88
+ {
89
+ input : '{"zeroFloat": 0.00}' ,
90
+ expected :
91
+ 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat"`\n}' ,
92
+ expectedWithExample :
93
+ 'type AutoGenerated struct {\n\tZeroFloat float64 `json:"zeroFloat" example:"0.1"`\n}'
94
+ } ,
95
+ {
96
+ input : '{"positiveFloat": 1.00}' ,
97
+ expected :
98
+ 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat"`\n}' ,
99
+ expectedWithExample :
100
+ 'type AutoGenerated struct {\n\tPositiveFloat float64 `json:"positiveFloat" example:"1.1"`\n}'
101
+ } ,
102
+ {
103
+ input : '{"negativeFloats": [-1.00, -2.00, -3.00]}' ,
104
+ expected :
105
+ 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}' ,
106
+ expectedWithExample :
107
+ 'type AutoGenerated struct {\n\tNegativeFloats []float64 `json:"negativeFloats"`\n}'
108
+ } ,
109
+ {
110
+ input : '{"zeroFloats": [0.00, 0.00, 0.00]}' ,
111
+ expected :
112
+ 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}' ,
113
+ expectedWithExample :
114
+ 'type AutoGenerated struct {\n\tZeroFloats []float64 `json:"zeroFloats"`\n}'
115
+ } ,
116
+ {
117
+ input : '{"positiveFloats": [1.00, 2.00, 3.00]}' ,
118
+ expected :
119
+ 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}' ,
120
+ expectedWithExample :
121
+ 'type AutoGenerated struct {\n\tPositiveFloats []float64 `json:"positiveFloats"`\n}'
122
+ } ,
81
123
{
82
124
input : '{"topLevel": { "secondLevel": "exampleDataHere"} }' ,
83
125
expected :
@@ -112,4 +154,4 @@ function test(includeExampleData) {
112
154
}
113
155
114
156
test ( false ) ;
115
- test ( true )
157
+ test ( true )
0 commit comments