mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
fix: form fields of request optional (#4755)
Signed-off-by: soasurs <soasurs@gmail.com>
This commit is contained in:
@@ -57,13 +57,13 @@ func (m Member) Tags() []*Tag {
|
||||
|
||||
// IsOptional returns true if tag is optional
|
||||
func (m Member) IsOptional() bool {
|
||||
if !m.IsBodyMember() {
|
||||
if !m.IsBodyMember() && !m.IsFormMember() {
|
||||
return false
|
||||
}
|
||||
|
||||
tag := m.Tags()
|
||||
for _, item := range tag {
|
||||
if item.Key == bodyTagKey {
|
||||
if item.Key == bodyTagKey || item.Key == formTagKey {
|
||||
if stringx.Contains(item.Options, "optional") {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user