mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
chopping through index changes, basic design works.
seems to be holding, more tests to change. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -348,17 +348,28 @@ func (index *SpecIndex) performExternalLookup(uri []string) *Reference {
|
||||
absoluteFileLocation, _ = filepath.Abs(filepath.Join(filepath.Dir(index.specAbsolutePath), file))
|
||||
}
|
||||
|
||||
// extract the document from the rolodex.
|
||||
rFile, rError := index.rolodex.Open(absoluteFileLocation)
|
||||
if rError != nil {
|
||||
logger.Error("unable to open rolodex file", "file", absoluteFileLocation, "error", rError)
|
||||
return nil
|
||||
}
|
||||
// if the absolute file location has no file ext, then get the rolodex root.
|
||||
ext := filepath.Ext(absoluteFileLocation)
|
||||
|
||||
parsedDocument, err := rFile.GetContentAsYAMLNode()
|
||||
if err != nil {
|
||||
logger.Error("unable to parse rolodex file", "file", absoluteFileLocation, "error", err)
|
||||
return nil
|
||||
var parsedDocument *yaml.Node
|
||||
var err error
|
||||
if ext != "" {
|
||||
|
||||
// extract the document from the rolodex.
|
||||
rFile, rError := index.rolodex.Open(absoluteFileLocation)
|
||||
|
||||
if rError != nil {
|
||||
logger.Error("unable to open rolodex file", "file", absoluteFileLocation, "error", rError)
|
||||
return nil
|
||||
}
|
||||
|
||||
parsedDocument, err = rFile.GetContentAsYAMLNode()
|
||||
if err != nil {
|
||||
logger.Error("unable to parse rolodex file", "file", absoluteFileLocation, "error", err)
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
parsedDocument = index.root
|
||||
}
|
||||
|
||||
//fmt.Printf("parsedDocument: %v\n", parsedDocument)
|
||||
|
||||
Reference in New Issue
Block a user