From 61641581eb40a941b56f05b2fe969812a0011394 Mon Sep 17 00:00:00 2001 From: soasurs Date: Tue, 8 Apr 2025 21:05:21 +0800 Subject: [PATCH] fix: form fields of request optional (#4755) Signed-off-by: soasurs --- tools/goctl/api/spec/fn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/goctl/api/spec/fn.go b/tools/goctl/api/spec/fn.go index d208a8c20..1032b3293 100644 --- a/tools/goctl/api/spec/fn.go +++ b/tools/goctl/api/spec/fn.go @@ -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 }