gf/protocol/goai/goai_callback.go

29 lines
664 B
Go
Raw Normal View History

2021-10-02 18:54:06 +08:00
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
2021-10-02 14:52:28 +08:00
package goai
2021-10-02 18:54:06 +08:00
import (
2021-10-11 21:41:56 +08:00
"github.com/gogf/gf/v2/internal/json"
2021-10-02 18:54:06 +08:00
)
2021-10-02 14:52:28 +08:00
// Callback is specified by OpenAPI/Swagger standard version 3.0.
type Callback map[string]*Path
type Callbacks map[string]*CallbackRef
type CallbackRef struct {
Ref string
Value *Callback
}
2021-10-02 18:54:06 +08:00
func (r CallbackRef) MarshalJSON() ([]byte, error) {
if r.Ref != "" {
return formatRefToBytes(r.Ref), nil
}
return json.Marshal(r.Value)
}