Skip to content

Commit

Permalink
Remove deprecated import and storage API loading from the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Nov 6, 2024
1 parent f0a4a8d commit c5a5a84
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
19 changes: 0 additions & 19 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package api

import (
"fmt"
"path/filepath"
"strings"

"github.com/yaoapp/gou/api"
"github.com/yaoapp/gou/application"
"github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/data"
"github.com/yaoapp/yao/share"
)

Expand All @@ -28,23 +26,6 @@ func Load(cfg config.Config) error {
return err
}, exts...)

// Load APIs from bindata (**will be removed in the future**)
names := []string{"import", "storage"}
for _, name := range names {
file := filepath.Join("yao", "apis", fmt.Sprintf("%s.http.json", name))
id := fmt.Sprintf("xiang.%s", name)

source, err := data.Read(file)
if err != nil {
messages = append(messages, err.Error())
}

_, err = api.LoadSource(file, source, id)
if err != nil {
messages = append(messages, err.Error())
}
}

if len(messages) > 0 {
return fmt.Errorf(strings.Join(messages, ";\n"))
}
Expand Down
4 changes: 2 additions & 2 deletions api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func check(t *testing.T) {
assert.True(t, ids["user"])
assert.True(t, ids["user.pet"])

assert.True(t, ids["xiang.import"]) // will be removed in the future
assert.True(t, ids["xiang.storage"]) // will be removed in the future
// assert.True(t, ids["xiang.import"]) // will be removed in the future
// assert.True(t, ids["xiang.storage"]) // will be removed in the future

// wskeys := []string{}
// for key := range websocket.Upgraders {
Expand Down
6 changes: 0 additions & 6 deletions engine/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,6 @@ func Reload(cfg config.Config, options LoadOption) (err error) {
printErr(cfg.Mode, "Widgets", err)
}

// Load Importers
err = importer.Load(cfg)
if err != nil {
printErr(cfg.Mode, "Plugin", err)
}

// Load Apis
err = api.Load(cfg) // 加载业务接口 API
if err != nil {
Expand Down

0 comments on commit c5a5a84

Please sign in to comment.