mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 04:20:14 +00:00
@@ -5,6 +5,8 @@ package base
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"log/slog"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/pb33f/libopenapi/datamodel/low"
|
"github.com/pb33f/libopenapi/datamodel/low"
|
||||||
@@ -161,6 +163,9 @@ properties:
|
|||||||
func TestSchemaProxy_Build_HashFail(t *testing.T) {
|
func TestSchemaProxy_Build_HashFail(t *testing.T) {
|
||||||
|
|
||||||
sp := new(SchemaProxy)
|
sp := new(SchemaProxy)
|
||||||
|
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError}))
|
||||||
|
idx := index.NewSpecIndexWithConfig(nil, &index.SpecIndexConfig{Logger: logger})
|
||||||
|
sp.idx = idx
|
||||||
v := sp.Hash()
|
v := sp.Hash()
|
||||||
assert.Equal(t, [32]byte{}, v)
|
assert.Equal(t, [32]byte{}, v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ func NewSpecIndexWithConfig(rootNode *yaml.Node, config *SpecIndexConfig) *SpecI
|
|||||||
index.rolodex = config.Rolodex
|
index.rolodex = config.Rolodex
|
||||||
index.uri = config.uri
|
index.uri = config.uri
|
||||||
index.specAbsolutePath = config.SpecAbsolutePath
|
index.specAbsolutePath = config.SpecAbsolutePath
|
||||||
if rootNode == nil || len(rootNode.Content) <= 0 {
|
|
||||||
return index
|
|
||||||
}
|
|
||||||
if config.Logger != nil {
|
if config.Logger != nil {
|
||||||
index.logger = config.Logger
|
index.logger = config.Logger
|
||||||
} else {
|
} else {
|
||||||
@@ -46,7 +43,9 @@ func NewSpecIndexWithConfig(rootNode *yaml.Node, config *SpecIndexConfig) *SpecI
|
|||||||
Level: slog.LevelError,
|
Level: slog.LevelError,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
if rootNode == nil || len(rootNode.Content) <= 0 {
|
||||||
|
return index
|
||||||
|
}
|
||||||
index.root = rootNode
|
index.root = rootNode
|
||||||
return createNewIndex(rootNode, index, config.AvoidBuildIndex)
|
return createNewIndex(rootNode, index, config.AvoidBuildIndex)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user