Search code examples
goopenapi-generatorhivelocity.net

Update go-client with OpenAPI generator


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.


Solution

  • Above error is solved in this PR

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