mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
Added more docstrings
This commit is contained in:
@@ -155,7 +155,8 @@ type SpecIndexConfig struct {
|
|||||||
uri []string
|
uri []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTheoreticalRoot sets the spec file paths to a theoretical file path
|
// SetTheoreticalRoot sets the spec file paths to point to a theoretical spec file, which does not exist but is required
|
||||||
|
// in order to formulate the absolute path to root references correctly.
|
||||||
func (s *SpecIndexConfig) SetTheoreticalRoot() {
|
func (s *SpecIndexConfig) SetTheoreticalRoot() {
|
||||||
s.SpecFilePath = filepath.Join(s.BasePath, theoreticalRoot)
|
s.SpecFilePath = filepath.Join(s.BasePath, theoreticalRoot)
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -26,6 +27,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// theoreticalRoot is the name of the theoretical spec file used when a root spec file does not exist
|
||||||
theoreticalRoot = "root.yaml"
|
theoreticalRoot = "root.yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -156,11 +158,12 @@ func (index *SpecIndex) GetRolodex() *Rolodex {
|
|||||||
return index.rolodex
|
return index.rolodex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSpecFileName returns the root spec filename, if it exists, otherwise returns the theoretical root spec
|
||||||
func (index *SpecIndex) GetSpecFileName() string {
|
func (index *SpecIndex) GetSpecFileName() string {
|
||||||
if index == nil || index.rolodex == nil || index.rolodex.indexConfig == nil {
|
if index == nil || index.rolodex == nil || index.rolodex.indexConfig == nil || index.rolodex.indexConfig.SpecFilePath == "" {
|
||||||
return theoreticalRoot
|
return theoreticalRoot
|
||||||
}
|
}
|
||||||
return index.rolodex.indexConfig.SpecFilePath
|
return filepath.Base(index.rolodex.indexConfig.SpecFilePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetGlobalTagsNode returns document root tags node.
|
// GetGlobalTagsNode returns document root tags node.
|
||||||
|
|||||||
Reference in New Issue
Block a user