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
|
||||
}
|
||||
|
||||
// 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() {
|
||||
s.SpecFilePath = filepath.Join(s.BasePath, theoreticalRoot)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// theoreticalRoot is the name of the theoretical spec file used when a root spec file does not exist
|
||||
theoreticalRoot = "root.yaml"
|
||||
)
|
||||
|
||||
@@ -156,11 +158,12 @@ func (index *SpecIndex) GetRolodex() *Rolodex {
|
||||
return index.rolodex
|
||||
}
|
||||
|
||||
// GetSpecFileName returns the root spec filename, if it exists, otherwise returns the theoretical root spec
|
||||
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 index.rolodex.indexConfig.SpecFilePath
|
||||
return filepath.Base(index.rolodex.indexConfig.SpecFilePath)
|
||||
}
|
||||
|
||||
// GetGlobalTagsNode returns document root tags node.
|
||||
|
||||
Reference in New Issue
Block a user