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