improve package goai

This commit is contained in:
John Guo
2022-03-07 21:09:02 +08:00
parent 6d323cc529
commit 9cf6124c4c

View File

@ -94,7 +94,7 @@ func (oai *OpenApiV3) newParameterRefWithStructMethod(field gstructs.Field, path
parameter.Schema = schemaRef
// Required check.
if parameter.Schema.Value.Pattern != "" {
if parameter.Schema != nil && parameter.Schema.Value.Pattern != "" {
if gset.NewStrSetFrom(gstr.Split(parameter.Schema.Value.Pattern, "|")).Contains(patternKeyForRequired) {
parameter.Required = true
}