github.com/gogf/gf/v2@v2.7.4/net/goai/goai_callback.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package goai 8 9 import ( 10 "github.com/gogf/gf/v2/internal/json" 11 ) 12 13 // Callback is specified by OpenAPI/Swagger standard version 3.0. 14 type Callback map[string]*Path 15 16 type Callbacks map[string]*CallbackRef 17 18 type CallbackRef struct { 19 Ref string 20 Value *Callback 21 } 22 23 func (r CallbackRef) MarshalJSON() ([]byte, error) { 24 if r.Ref != "" { 25 return formatRefToBytes(r.Ref), nil 26 } 27 return json.Marshal(r.Value) 28 }