swag
swag copied to clipboard
Swag does not compatible with the `dive` rule of Go Playground Validator
Describe the bug
Swag does not compatible with the dive rule of Go Playground Validator
To Reproduce
I have a JSON request model
type SampleRequest struct {
items []string `json:"items" validate:"omitempty,dive,required"`
}
The
validatetag is from the Go Playground Validator (reference link for the ruledive). This means that theitemskey is optional, but if it is included in the JSON request, therequiredrule will be applied to elements ofitems.
Actual Behavior
- The generated Swagger documentation shows that the
itemskey is a required field.
Expected behavior
- The generated Swagger documentation shows that the
itemskey is an optional field.
Your swag version
1.8.3
Your go version
1.18.3 darwin/amd64
Desktop (please complete the following information):
- OS: macOS Monterey 12.4
- Browser: Google Chrome 103.0.5060.114 (Official Build) (x86_64)