mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
bump coverage
removed dead code after abs path change on lookup Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -609,19 +609,6 @@ func (index *SpecIndex) ExtractComponentsFromRefs(refs []*Reference) []*Referenc
|
|||||||
|
|
||||||
var refsToCheck []*Reference
|
var refsToCheck []*Reference
|
||||||
for _, ref := range refs {
|
for _, ref := range refs {
|
||||||
|
|
||||||
// check reference for backslashes (hah yeah seen this too!)
|
|
||||||
if strings.Contains(ref.Definition, "\\\\") {
|
|
||||||
_, path := utils.ConvertComponentIdIntoFriendlyPathSearch(ref.Definition)
|
|
||||||
indexError := &IndexingError{
|
|
||||||
Err: fmt.Errorf("component '%s' contains a backslash '\\'. It's not valid", ref.Definition),
|
|
||||||
Node: ref.Node,
|
|
||||||
Path: path,
|
|
||||||
}
|
|
||||||
index.refErrors = append(index.refErrors, indexError)
|
|
||||||
continue
|
|
||||||
|
|
||||||
}
|
|
||||||
refsToCheck = append(refsToCheck, ref)
|
refsToCheck = append(refsToCheck, ref)
|
||||||
}
|
}
|
||||||
mappedRefsInSequence := make([]*ReferenceMapped, len(refsToCheck))
|
mappedRefsInSequence := make([]*ReferenceMapped, len(refsToCheck))
|
||||||
|
|||||||
@@ -514,9 +514,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
if strings.HasPrefix(exp[0], "http") {
|
if strings.HasPrefix(exp[0], "http") {
|
||||||
fullDef = value
|
fullDef = value
|
||||||
} else {
|
} else {
|
||||||
if filepath.IsAbs(exp[0]) {
|
|
||||||
fullDef = value
|
|
||||||
} else {
|
|
||||||
if strings.HasPrefix(ref.FullDefinition, "http") {
|
if strings.HasPrefix(ref.FullDefinition, "http") {
|
||||||
|
|
||||||
// split the http URI into parts
|
// split the http URI into parts
|
||||||
@@ -539,7 +537,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
fullDef = fmt.Sprintf("%s#/%s", abs, exp[1])
|
fullDef = fmt.Sprintf("%s#/%s", abs, exp[1])
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// local component, full def is based on passed in ref
|
// local component, full def is based on passed in ref
|
||||||
@@ -568,9 +566,6 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
if strings.HasPrefix(value, "http") {
|
if strings.HasPrefix(value, "http") {
|
||||||
fullDef = value
|
fullDef = value
|
||||||
} else {
|
} else {
|
||||||
if filepath.IsAbs(value) {
|
|
||||||
fullDef = value
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// split the full def into parts
|
// split the full def into parts
|
||||||
fileDef := strings.Split(ref.FullDefinition, "#/")
|
fileDef := strings.Split(ref.FullDefinition, "#/")
|
||||||
@@ -585,7 +580,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
} else {
|
} else {
|
||||||
fullDef, _ = filepath.Abs(utils.CheckPathOverlap(filepath.Dir(fileDef[0]), exp[0], string(filepath.Separator)))
|
fullDef, _ = filepath.Abs(utils.CheckPathOverlap(filepath.Dir(fileDef[0]), exp[0], string(filepath.Separator)))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,9 +686,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
if strings.HasPrefix(l, "http") {
|
if strings.HasPrefix(l, "http") {
|
||||||
def = l
|
def = l
|
||||||
} else {
|
} else {
|
||||||
if filepath.IsAbs(l) {
|
|
||||||
def = l
|
|
||||||
} else {
|
|
||||||
// check if were dealing with a remote file
|
// check if were dealing with a remote file
|
||||||
if strings.HasPrefix(ref.FullDefinition, "http") {
|
if strings.HasPrefix(ref.FullDefinition, "http") {
|
||||||
|
|
||||||
@@ -708,7 +701,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
abs, _ := filepath.Abs(filepath.Join(filepath.Dir(lookupRef[0]), l))
|
abs, _ := filepath.Abs(filepath.Join(filepath.Dir(lookupRef[0]), l))
|
||||||
def = abs
|
def = abs
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,9 +807,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
if strings.HasPrefix(l, "http") {
|
if strings.HasPrefix(l, "http") {
|
||||||
def = l
|
def = l
|
||||||
} else {
|
} else {
|
||||||
if filepath.IsAbs(l) {
|
|
||||||
def = l
|
|
||||||
} else {
|
|
||||||
// check if were dealing with a remote file
|
// check if were dealing with a remote file
|
||||||
if strings.HasPrefix(ref.FullDefinition, "http") {
|
if strings.HasPrefix(ref.FullDefinition, "http") {
|
||||||
|
|
||||||
@@ -831,7 +822,7 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No
|
|||||||
abs, _ := filepath.Abs(utils.CheckPathOverlap(filepath.Dir(lookupRef[0]), l, string(filepath.Separator)))
|
abs, _ := filepath.Abs(utils.CheckPathOverlap(filepath.Dir(lookupRef[0]), l, string(filepath.Separator)))
|
||||||
def = abs
|
def = abs
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user