mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
tpl/openapi3: Wrap *kopenapi3.T
To make it easier to document.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user