improve package goai

This commit is contained in:
John Guo
2022-04-28 20:37:15 +08:00
parent b7201e111d
commit abbc96a873
3 changed files with 3 additions and 3 deletions

View File

@ -241,7 +241,7 @@ func formatRefToBytes(ref string) []byte {
return []byte(fmt.Sprintf(`{"$ref":"#/components/schemas/%s"}`, ref))
}
func isValidTag(key string) bool {
func isValidParameterName(key string) bool {
if key == "-" {
return false
}

View File

@ -75,7 +75,7 @@ func (oai *OpenApiV3) newParameterRefWithStructMethod(field gstructs.Field, path
parameter.Schema = schemaRef
// Ignore parameter.
if !isValidTag(parameter.Name) {
if !isValidParameterName(parameter.Name) {
return nil, nil
}

View File

@ -189,7 +189,7 @@ func (oai *OpenApiV3) structToSchema(object interface{}) (*Schema, error) {
schema.Required = append(schema.Required, key)
}
}
if !isValidTag(key) {
if !isValidParameterName(key) {
ignoreProperties = append(ignoreProperties, key)
}
return true