github.com/wangyougui/gf/v2@v2.6.5/net/goai/goai_header.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/wangyougui/gf. 6 7 package goai 8 9 import ( 10 "github.com/wangyougui/gf/v2/internal/json" 11 ) 12 13 // Header is specified by OpenAPI/Swagger 3.0 standard. 14 // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#headerObject 15 type Header struct { 16 Parameter 17 } 18 19 type Headers map[string]HeaderRef 20 21 type HeaderRef struct { 22 Ref string 23 Value *Header 24 } 25 26 func (r HeaderRef) MarshalJSON() ([]byte, error) { 27 if r.Ref != "" { 28 return formatRefToBytes(r.Ref), nil 29 } 30 return json.Marshal(r.Value) 31 }