Skip to content

Commit

Permalink
Extend multipleOf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmycannlfs committed Sep 27, 2021
1 parent b0b63f4 commit 87996d1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,7 @@ func TestParseSimpleApi_ForSnakecase(t *testing.T) {
},
"price": {
"type": "number",
"multipleOf": 0.01,
"example": 3.25
},
"status": {
Expand Down Expand Up @@ -1435,6 +1436,7 @@ func TestParseSimpleApi_ForLowerCamelcase(t *testing.T) {
},
"price": {
"type": "number",
"multipleOf": 0.01,
"example": 3.25
},
"status": {
Expand Down
2 changes: 1 addition & 1 deletion testdata/pet/web/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Pet struct {
PhotoUrls []string `json:"photo_urls" example:"http://test/image/1.jpg,http://test/image/2.jpg"`
Tags []Tag `json:"tags"`
Status string `json:"status"`
Price float32 `json:"price" example:"3.25"`
Price float32 `json:"price" example:"3.25" multipleOf:"0.01"`
IsAlive bool `json:"is_alive" example:"true"`
}

Expand Down
1 change: 1 addition & 0 deletions testdata/simple/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@
"type": "number",
"maximum": 1000,
"minimum": 1,
"multipleOf": 0.01,
"example": 3.25
},
"status": {
Expand Down
2 changes: 1 addition & 1 deletion testdata/simple/web/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Pet struct {
Pets *[]Pet2 `json:"pets"`
Pets2 []*Pet2 `json:"pets2"`
Status string `json:"status" enums:"healthy,ill"`
Price float32 `json:"price" example:"3.25" minimum:"1.0" maximum:"1000"`
Price float32 `json:"price" example:"3.25" minimum:"1.0" maximum:"1000" multipleOf:"0.01"`
IsAlive bool `json:"is_alive" example:"true" default:"true"`
Data interface{} `json:"data"`
Hidden string `json:"-"`
Expand Down
2 changes: 1 addition & 1 deletion testdata/simple2/web/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Pet struct {
Pets *[]Pet2
Pets2 []*Pet2
Status string
Price float32 `example:"3.25" validate:"required,gte=0,lte=130"`
Price float32 `example:"3.25" validate:"required,gte=0,lte=130" multipleOf:"0.01"`
IsAlive bool `example:"true"`
Data interface{}
Hidden string `json:"-"`
Expand Down
2 changes: 1 addition & 1 deletion testdata/simple3/web/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Pet struct {
Pets *[]Pet2
Pets2 []*Pet2
Status string
Price float32 `example:"3.25"`
Price float32 `example:"3.25" multipleOf:"0.01"`
IsAlive bool `example:"true"`
Data interface{}
Hidden string `json:"-"`
Expand Down

0 comments on commit 87996d1

Please sign in to comment.