The line import openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" is added when generating from openapi-generator prompts login

huangapple go评论100阅读模式
英文:

The line import openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" is added when generating from openapi-generator prompts login

问题

我正在使用openapi生成器生成我的REST API客户端。它生成了以下代码行:

openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"

在我的导入部分,但我无法理解为什么要这样做。当我运行go mod vendor命令时,它提示我登录,而这行代码存在时。这行代码试图导入什么?我在一个企业版的GitHub上,可能会复杂化事情。示例README中说要添加这行代码,但没有解释它的作用。链接

英文:

I am using openapi generator to generate my rest api client. It generates the line

openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"

In my imports but I can't for the life of me understand why. Running a go mod vendor prompts me to sign in while this line is in place. What is this trying to import? I'm on an enterprise github, which would complicate things. The example README says to add this line but provides no explanation of what it is doing https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/go/go-petstore/README.md#:~:text=%22github.com/GIT_USER_ID/GIT_REPO_ID%22

答案1

得分: 2

你可以将这些作为参数传递给OpenAPI Generator客户端:

openapi-generator-cli generate \
    -i openapi.yaml
    -g go \
    -p packageName=mypackage \
    -o /src \
    --git-repo-id my-go-lib/v1 --git-user-id user1 \

这将导致以下结果:

openapiclient "github.com/user1/my-go-lib/v1"
英文:

You can pass those to the OpenAPI Generator client as parameters:

openapi-generator-cli generate \
    -i openapi.yaml
    -g go \
    -p packageName=mypackage \
    -o /src \
    --git-repo-id my-go-lib/v1 --git-user-id user1 \

that will result in

openapiclient "github.com/user1/my-go-lib/v1"

huangapple
  • 本文由 发表于 2023年2月10日 07:26:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/75405511.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定