fix: OpenAPI cannot correctly identify the file type under the canoni… (#2898)

This commit is contained in:
the harder the luckier
2023-08-28 21:52:22 +08:00
committed by GitHub
parent 3841f05e02
commit 7d4c59ac5a
2 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,7 @@ const (
TypeBoolean = `boolean`
TypeArray = `array`
TypeString = `string`
TypeFile = `file`
TypeObject = `object`
FormatInt32 = `int32`
FormatInt64 = `int64`
@ -145,6 +146,8 @@ func (oai *OpenApiV3) golangTypeToOAIType(t reflect.Type) string {
switch t.String() {
case `time.Time`, `gtime.Time`:
return TypeString
case `ghttp.UploadFile`:
return TypeFile
}
return TypeObject

View File

@ -76,7 +76,7 @@ func (oai *OpenApiV3) newSchemaRefWithGolangType(golangType reflect.Type, tagMap
}
schemaRef.Value = schema
switch oaiType {
case TypeString:
case TypeString, TypeFile:
// Nothing to do.
case TypeInteger:
if schemaRef.Value.Default != nil {