tpl/openapi3: Wrap *kopenapi3.T

To make it easier to document.
This commit is contained in:
Bjørn Erik Pedersen 2022-12-13 11:11:14 +01:00
parent b54de1bd9b
commit 87e898a17a

View file

@ -49,7 +49,12 @@ type Namespace struct {
deps *deps.Deps 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() key := r.Key()
if key == "" { if key == "" {
return nil, errors.New("no Key set in Resource") 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) err = kopenapi3.NewLoader().ResolveRefsIn(s, nil)
return s, err return &OpenAPIDocument{T: s}, err
}) })
if err != nil { if err != nil {
return nil, err return nil, err
} }
return v.(*kopenapi3.T), nil return v.(*OpenAPIDocument), nil
} }