mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
openapi generating feature
This commit is contained in:
@ -80,6 +80,7 @@ const (
|
||||
TagNamePath = `path`
|
||||
TagNameMethod = `method`
|
||||
TagNameIn = `in`
|
||||
TagNameMime = `mime`
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -136,7 +136,14 @@ func (oai *OpenApiV3) addPath(in addPathInput) error {
|
||||
}
|
||||
)
|
||||
// Supported mime types of request.
|
||||
for _, v := range oai.Config.ReadContentTypes {
|
||||
var (
|
||||
contentTypes = oai.Config.ReadContentTypes
|
||||
tagMimeValue = gmeta.Get(inputObject.Interface(), TagNameMime).String()
|
||||
)
|
||||
if tagMimeValue != "" {
|
||||
contentTypes = gstr.SplitAndTrim(tagMimeValue, ",")
|
||||
}
|
||||
for _, v := range contentTypes {
|
||||
requestBody.Content[v] = MediaType{
|
||||
Schema: &SchemaRef{
|
||||
Ref: inputStructTypeName,
|
||||
@ -178,7 +185,14 @@ func (oai *OpenApiV3) addPath(in addPathInput) error {
|
||||
}
|
||||
}
|
||||
// Supported mime types of response.
|
||||
for _, v := range oai.Config.WriteContentTypes {
|
||||
var (
|
||||
contentTypes = oai.Config.ReadContentTypes
|
||||
tagMimeValue = gmeta.Get(outputObject.Interface(), TagNameMime).String()
|
||||
)
|
||||
if tagMimeValue != "" {
|
||||
contentTypes = gstr.SplitAndTrim(tagMimeValue, ",")
|
||||
}
|
||||
for _, v := range contentTypes {
|
||||
response.Content[v] = MediaType{
|
||||
Schema: &SchemaRef{
|
||||
Ref: outputStructTypeName,
|
||||
|
||||
Reference in New Issue
Block a user