Working on building out models

a recursive approach? or a dfs approach? not sure yet. still playing with ideas.
This commit is contained in:
Dave Shanley
2022-07-29 09:44:37 -04:00
parent a906d46227
commit eda834f79f
9 changed files with 210 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
package openapi
import (
"github.com/pb33f/libopenapi/datamodel"
v3 "github.com/pb33f/libopenapi/datamodel/low/3.0"
)
func CreateDocument(spec []byte) (*v3.Document, error) {
// extract details from spec
info, err := datamodel.ExtractSpecInfo(spec)
if err != nil {
return nil, err
}
doc := &v3.Document{}
doc.Build(info.RootNode.Content[0])
return doc, nil
}