mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
Added ‘bundler’ module
resolves a v3 document or a model into a single document. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -571,7 +571,10 @@ func (index *SpecIndex) ExtractComponentsFromRefs(refs []*Reference) []*Referenc
|
||||
var found []*Reference
|
||||
|
||||
// run this async because when things get recursive, it can take a while
|
||||
c := make(chan bool)
|
||||
var c chan bool
|
||||
if !index.config.ExtractRefsSequentially {
|
||||
c = make(chan bool)
|
||||
}
|
||||
|
||||
locate := func(ref *Reference, refIndex int, sequence []*ReferenceMapped) {
|
||||
located := index.FindComponent(ref.FullDefinition)
|
||||
@@ -604,7 +607,9 @@ func (index *SpecIndex) ExtractComponentsFromRefs(refs []*Reference) []*Referenc
|
||||
index.refErrors = append(index.refErrors, indexError)
|
||||
index.errorLock.Unlock()
|
||||
}
|
||||
c <- true
|
||||
if !index.config.ExtractRefsSequentially {
|
||||
c <- true
|
||||
}
|
||||
}
|
||||
|
||||
var refsToCheck []*Reference
|
||||
@@ -615,14 +620,20 @@ func (index *SpecIndex) ExtractComponentsFromRefs(refs []*Reference) []*Referenc
|
||||
|
||||
for r := range refsToCheck {
|
||||
// expand our index of all mapped refs
|
||||
go locate(refsToCheck[r], r, mappedRefsInSequence)
|
||||
//locate(refsToCheck[r], r, mappedRefsInSequence) // used for sync testing.
|
||||
if !index.config.ExtractRefsSequentially {
|
||||
go locate(refsToCheck[r], r, mappedRefsInSequence) // run async
|
||||
} else {
|
||||
locate(refsToCheck[r], r, mappedRefsInSequence) // run synchronously
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
completedRefs := 0
|
||||
for completedRefs < len(refsToCheck) {
|
||||
<-c
|
||||
completedRefs++
|
||||
if !index.config.ExtractRefsSequentially {
|
||||
completedRefs := 0
|
||||
for completedRefs < len(refsToCheck) {
|
||||
<-c
|
||||
completedRefs++
|
||||
}
|
||||
}
|
||||
for m := range mappedRefsInSequence {
|
||||
if mappedRefsInSequence[m] != nil {
|
||||
|
||||
Reference in New Issue
Block a user