Fixed other references to "root.yaml"

This commit is contained in:
Calvin Lobo
2024-08-28 14:32:37 -04:00
committed by quobix
parent 07ed25a870
commit c8186468ae
4 changed files with 28 additions and 7 deletions

View File

@@ -25,6 +25,10 @@ import (
"gopkg.in/yaml.v3"
)
const (
theoreticalRoot = "root.yaml"
)
// NewSpecIndexWithConfig will create a new index of an OpenAPI or Swagger spec. It uses the same logic as NewSpecIndex
// except it sets a base URL for resolving relative references, except it also allows for granular control over
// how the index is set up.
@@ -152,6 +156,13 @@ func (index *SpecIndex) GetRolodex() *Rolodex {
return index.rolodex
}
func (index *SpecIndex) GetSpecFileName() string {
if index == nil || index.rolodex == nil || index.rolodex.indexConfig == nil {
return theoreticalRoot
}
return index.rolodex.indexConfig.SpecFilePath
}
// GetGlobalTagsNode returns document root tags node.
func (index *SpecIndex) GetGlobalTagsNode() *yaml.Node {
return index.tagsNode