Components are in, writing new content for them and tests!

And, thats basically it (almost)
This commit is contained in:
Dave Shanley
2022-08-09 10:23:18 -04:00
parent ec87ddf8cc
commit 402a7c7e5a
9 changed files with 225 additions and 55 deletions

View File

@@ -39,6 +39,7 @@ func CreateDocument(info *datamodel.SpecInfo) (*v3.Document, error) {
extractServers,
extractTags,
extractPaths,
extractComponents,
}
wg.Add(len(extractionFuncs))
for _, f := range extractionFuncs {
@@ -68,6 +69,21 @@ func extractInfo(info *datamodel.SpecInfo, doc *v3.Document) error {
return nil
}
func extractComponents(info *datamodel.SpecInfo, doc *v3.Document) error {
_, ln, vn := utils.FindKeyNodeFull(v3.ComponentsLabel, info.RootNode.Content)
if vn != nil {
ir := v3.Components{}
err := v3.BuildModel(vn, &ir)
if err != nil {
return err
}
err = ir.Build(vn)
nr := low.NodeReference[*v3.Components]{Value: &ir, ValueNode: vn, KeyNode: ln}
doc.Components = nr
}
return nil
}
func extractServers(info *datamodel.SpecInfo, doc *v3.Document) error {
_, ln, vn := utils.FindKeyNodeFull(v3.ServersLabel, info.RootNode.Content)
if vn != nil {