Skip to content

Commit 6164158

Browse files
authored
fix: form fields of request optional (#4755)
Signed-off-by: soasurs <soasurs@gmail.com>
1 parent 6f2730d commit 6164158

File tree

1 file changed

+2
-2
lines changed
  • tools/goctl/api/spec

1 file changed

+2
-2
lines changed

tools/goctl/api/spec/fn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ func (m Member) Tags() []*Tag {
5757

5858
// IsOptional returns true if tag is optional
5959
func (m Member) IsOptional() bool {
60-
if !m.IsBodyMember() {
60+
if !m.IsBodyMember() && !m.IsFormMember() {
6161
return false
6262
}
6363

6464
tag := m.Tags()
6565
for _, item := range tag {
66-
if item.Key == bodyTagKey {
66+
if item.Key == bodyTagKey || item.Key == formTagKey {
6767
if stringx.Contains(item.Options, "optional") {
6868
return true
6969
}

0 commit comments

Comments
 (0)