英文:
Update go-client with OpenAPI generator
问题
我尝试更新 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: 非本地包中的本地导入“./openapi”
FAIL github.com/hivelocity/hivelocity-client-go/client/test [设置失败]
? github.com/hivelocity/hivelocity-client-go/client [没有测试文件]
FAIL
make: *** [Makefile:17: client] 错误 1
生成的代码如下所示:
/*
Hivelocity API
Testing AccountApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package client
import (
openapiclient "./openapi"
没有 openapi 目录或包。
如何修复这个问题?
这是我的 fork:https://github.com/guettli/hivelocity-client-go
我唯一改变的是 Makefile 中的内容:
-GENERATOR_VERSION=4.3.1
+GENERATOR_VERSION=6.2.1
如果我运行 make
,上述错误就会发生。
英文:
I try to update https://github.com/hivelocity/hivelocity-client-go
I updated the generator version in the Makefile to 6.2.1
, but I get this error message at the end:
...
...
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
The generated code looks like this:
/*
Hivelocity API
Testing AccountApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package client
import (
openapiclient "./openapi"
There is no openapi directory or package.
How could this get fixed?
Here is my fork: https://github.com/guettli/hivelocity-client-go
The only thing I changed was in the Makefile:
-GENERATOR_VERSION=4.3.1
+GENERATOR_VERSION=6.2.1
If I run make
above error happens.
答案1
得分: 0
上述错误在这个PR中得到解决。
- {{goImportAlias}} "./openapi"
+ {{goImportAlias}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}"
英文:
Above error is solved in this PR
- {{goImportAlias}} "./openapi"
+ {{goImportAlias}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论