mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 04:20:11 +00:00
fix: for all tests
This commit is contained in:
@@ -1011,22 +1011,24 @@ func buildPropertyMap(ctx context.Context, root *yaml.Node, idx *index.SpecIndex
|
||||
continue
|
||||
}
|
||||
|
||||
foundCtx := ctx
|
||||
// check our prop isn't reference
|
||||
refString := ""
|
||||
var refNode *yaml.Node
|
||||
if h, _, l := utils.IsNodeRefValue(prop); h {
|
||||
ref, _, _, _ := low.LocateRefNodeWithContext(ctx, prop, idx)
|
||||
ref, _, _, fctx := low.LocateRefNodeWithContext(ctx, prop, idx)
|
||||
if ref != nil {
|
||||
refNode = prop
|
||||
prop = ref
|
||||
refString = l
|
||||
foundCtx = fctx
|
||||
} else {
|
||||
return nil, fmt.Errorf("schema properties build failed: cannot find reference %s, line %d, col %d",
|
||||
prop.Content[1].Value, prop.Content[1].Line, prop.Content[1].Column)
|
||||
}
|
||||
}
|
||||
|
||||
sp := &SchemaProxy{ctx: ctx, kn: currentProp, vn: prop, idx: idx}
|
||||
sp := &SchemaProxy{ctx: foundCtx, kn: currentProp, vn: prop, idx: idx}
|
||||
sp.SetReference(refString, refNode)
|
||||
|
||||
propertyMap.Set(low.KeyReference[string]{
|
||||
|
||||
@@ -237,7 +237,7 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve(t *testing.T) {
|
||||
files := fileFS.GetFiles()
|
||||
fileLen := len(files)
|
||||
|
||||
assert.Equal(t, 1696, fileLen)
|
||||
assert.Equal(t, 1699, fileLen)
|
||||
|
||||
rolo.AddLocalFS(basePath, fileFS)
|
||||
|
||||
@@ -249,8 +249,8 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve(t *testing.T) {
|
||||
|
||||
assert.NotNil(t, index)
|
||||
|
||||
assert.Len(t, index.GetMappedReferencesSequenced(), 300)
|
||||
assert.Len(t, index.GetMappedReferences(), 300)
|
||||
assert.Len(t, index.GetMappedReferencesSequenced(), 301)
|
||||
assert.Len(t, index.GetMappedReferences(), 301)
|
||||
assert.Len(t, fileFS.GetErrors(), 0)
|
||||
|
||||
// check circular references
|
||||
@@ -258,9 +258,9 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve(t *testing.T) {
|
||||
assert.Len(t, rolo.GetCaughtErrors(), 0)
|
||||
assert.Len(t, rolo.GetIgnoredCircularReferences(), 0)
|
||||
|
||||
assert.Equal(t, int64(1330184), rolo.RolodexFileSize())
|
||||
assert.Equal(t, int64(1333243), rolo.RolodexFileSize())
|
||||
assert.Equal(t, "1.27 MB", rolo.RolodexFileSizeAsString())
|
||||
assert.Equal(t, 1696, rolo.RolodexTotalFiles())
|
||||
assert.Equal(t, 1699, rolo.RolodexTotalFiles())
|
||||
}
|
||||
|
||||
func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve_RecursiveLookup(t *testing.T) {
|
||||
@@ -314,7 +314,7 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve_RecursiveLookup(t *test
|
||||
files := fileFS.GetFiles()
|
||||
fileLen := len(files)
|
||||
|
||||
assert.Equal(t, 1682, fileLen)
|
||||
assert.Equal(t, 1685, fileLen)
|
||||
|
||||
assert.NoError(t, rErr)
|
||||
|
||||
@@ -322,8 +322,8 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve_RecursiveLookup(t *test
|
||||
|
||||
assert.NotNil(t, index)
|
||||
|
||||
assert.Len(t, index.GetMappedReferencesSequenced(), 300)
|
||||
assert.Len(t, index.GetMappedReferences(), 300)
|
||||
assert.Len(t, index.GetMappedReferencesSequenced(), 301)
|
||||
assert.Len(t, index.GetMappedReferences(), 301)
|
||||
assert.Len(t, fileFS.GetErrors(), 0)
|
||||
|
||||
// check circular references
|
||||
@@ -331,9 +331,9 @@ func TestSpecIndex_DigitalOcean_FullCheckoutLocalResolve_RecursiveLookup(t *test
|
||||
assert.Len(t, rolo.GetCaughtErrors(), 0)
|
||||
assert.Len(t, rolo.GetIgnoredCircularReferences(), 0)
|
||||
|
||||
assert.Equal(t, int64(1270079), rolo.RolodexFileSize())
|
||||
assert.Equal(t, int64(1273069), rolo.RolodexFileSize())
|
||||
assert.Equal(t, "1.21 MB", rolo.RolodexFileSizeAsString())
|
||||
assert.Equal(t, 1682, rolo.RolodexTotalFiles())
|
||||
assert.Equal(t, 1685, rolo.RolodexTotalFiles())
|
||||
}
|
||||
|
||||
func TestSpecIndex_DigitalOcean_LookupsNotAllowed(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user