mirror of
https://gitee.com/johng/gf
synced 2026-07-04 13:02:36 +08:00
fix: OpenAPI cannot correctly identify the file type under the canoni… (#2898)
This commit is contained in:
committed by
GitHub
parent
3841f05e02
commit
7d4c59ac5a
@ -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
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user