使用OpenAPI生成器更新go-client

czq61nw1  于 2023-01-10  发布在  Go
关注(0)|答案(1)|浏览(219)

我尝试更新https://github.com/hivelocity/hivelocity-client-go
我将Makefile中的生成器版本更新为6.2.1,但在最后收到以下错误消息:

...
...
go build github.com/hivelocity/hivelocity-client-go/client
go test ./...
# github.com/hivelocity/hivelocity-client-go/client/test
client/test/api_account_test.go:13:2: local import "./openapi" in non-local package
FAIL    github.com/hivelocity/hivelocity-client-go/client/test [setup failed]
?       github.com/hivelocity/hivelocity-client-go/client       [no test files]
FAIL
make: *** [Makefile:17: client] Error 1

生成的代码如下所示:

/*
Hivelocity API

Testing AccountApiService

*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech);

package client

import (
    openapiclient "./openapi"

没有openapi目录或包。
这怎么能修好呢?
这是我的叉子:https://github.com/guettli/hivelocity-client-go
我唯一更改的是Makefile:

-GENERATOR_VERSION=4.3.1
+GENERATOR_VERSION=6.2.1

如果我运行上面的make错误发生。

eanckbw9

eanckbw91#

上述错误在此PR中得到解决

-    {{goImportAlias}} "./openapi"
+    {{goImportAlias}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}"

相关问题