diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-12-13 11:11:14 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-12-14 12:29:40 +0100 |
commit | 87e898a17a52b5338bc9d554dd12b99a54aa2431 (patch) | |
tree | d9be143f412690227140dbb71c0ab8ae02ad37d4 /tpl/openapi | |
parent | b54de1bd9bbf38d4fa866ffeeafb1e79e9edcc58 (diff) | |
download | hugo-87e898a17a52b5338bc9d554dd12b99a54aa2431.tar.gz hugo-87e898a17a52b5338bc9d554dd12b99a54aa2431.zip |
tpl/openapi3: Wrap *kopenapi3.T
To make it easier to document.
Diffstat (limited to 'tpl/openapi')
-rw-r--r-- | tpl/openapi/openapi3/openapi3.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tpl/openapi/openapi3/openapi3.go b/tpl/openapi/openapi3/openapi3.go index 1eea04b25..9b84e9fbe 100644 --- a/tpl/openapi/openapi3/openapi3.go +++ b/tpl/openapi/openapi3/openapi3.go @@ -49,7 +49,12 @@ type Namespace struct { deps *deps.Deps } -func (ns *Namespace) Unmarshal(r resource.UnmarshableResource) (*kopenapi3.T, error) { +// OpenAPIDocument represents an OpenAPI 3 document. +type OpenAPIDocument struct { + *kopenapi3.T +} + +func (ns *Namespace) Unmarshal(r resource.UnmarshableResource) (*OpenAPIDocument, error) { key := r.Key() if key == "" { return nil, errors.New("no Key set in Resource") @@ -85,11 +90,11 @@ func (ns *Namespace) Unmarshal(r resource.UnmarshableResource) (*kopenapi3.T, er err = kopenapi3.NewLoader().ResolveRefsIn(s, nil) - return s, err + return &OpenAPIDocument{T: s}, err }) if err != nil { return nil, err } - return v.(*kopenapi3.T), nil + return v.(*OpenAPIDocument), nil } |