mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 20:47:49 +00:00
Support for relative links now in place #73
Tests all passing, runs super fast, pulls in every single DigitalOcean spec and parses it. There may be some issues deeper down in the models, but for now high level tests all pass.
This commit is contained in:
@@ -39,7 +39,6 @@ func generateIndexCollection(idx *index.SpecIndex) []func() map[string]*index.Re
|
||||
idx.GetAllHeaders,
|
||||
idx.GetAllCallbacks,
|
||||
idx.GetAllLinks,
|
||||
idx.GetAllExternalDocuments,
|
||||
idx.GetAllExamples,
|
||||
idx.GetAllRequestBodies,
|
||||
idx.GetAllResponses,
|
||||
@@ -51,6 +50,7 @@ func generateIndexCollection(idx *index.SpecIndex) []func() map[string]*index.Re
|
||||
// the reference being supplied. If there is a match found, the reference *yaml.Node is returned.
|
||||
func LocateRefNode(root *yaml.Node, idx *index.SpecIndex) (*yaml.Node, error) {
|
||||
if rf, _, rv := utils.IsNodeRefValue(root); rf {
|
||||
|
||||
// run through everything and return as soon as we find a match.
|
||||
// this operates as fast as possible as ever
|
||||
collections := generateIndexCollection(idx)
|
||||
@@ -89,11 +89,14 @@ func LocateRefNode(root *yaml.Node, idx *index.SpecIndex) (*yaml.Node, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// perform a search for the reference in the index
|
||||
foundRefs := idx.SearchIndexForReference(rv)
|
||||
if len(foundRefs) > 0 {
|
||||
return foundRefs[0].Node, nil
|
||||
}
|
||||
|
||||
// let's try something else to find our references.
|
||||
|
||||
// cant be found? last resort is to try a path lookup
|
||||
_, friendly := utils.ConvertComponentIdIntoFriendlyPathSearch(rv)
|
||||
if friendly != "" {
|
||||
|
||||
Reference in New Issue
Block a user