mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-14 18:30:02 +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
|
// IsOptional returns true if tag is optional
|
||||||
func (m Member) IsOptional() bool {
|
func (m Member) IsOptional() bool {
|
||||||
if !m.IsBodyMember() {
|
if !m.IsBodyMember() && !m.IsFormMember() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
tag := m.Tags()
|
tag := m.Tags()
|
||||||
for _, item := range tag {
|
for _, item := range tag {
|
||||||
if item.Key == bodyTagKey {
|
if item.Key == bodyTagKey || item.Key == formTagKey {
|
||||||
if stringx.Contains(item.Options, "optional") {
|
if stringx.Contains(item.Options, "optional") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user