Update go-client using OpenAPI generator

WBOY
Release: 2024-02-11 23:54:11
forward
997 people have browsed it

使用 OpenAPI 生成器更新 go-client

php editor Youzi would like to introduce an important update to you: the update of the OpenAPI generator, especially the update of go-client. The OpenAPI Generator is a tool that automatically generates client code based on API definition files. This update mainly targets go-client and brings some important improvements and new features. By using this update, developers can more easily generate high-quality Go language client code, improving development efficiency and code quality. Next, we'll detail the improvements and benefits this update brings.

Question content

I try to update https://github.com/hivelocity/hivelocity-client-go

I updated the generator version in the makefile to 6.2.1 but ended up getting this error message:

...
...
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
Copy after login

The generated code is as follows:

/*
hivelocity api

testing accountapiservice

*/

// code generated by openapi generator (https://openapi-generator.tech);

package client

import (
    openapiclient "./openapi"
Copy after login

No openapi directory or package.

how to solve this problem?

This is my branch: https://github.com/guettli/hivelocity-client-go

The only thing I changed was the makefile:

-GENERATOR_VERSION=4.3.1
+GENERATOR_VERSION=6.2.1
Copy after login

The above error occurs if I run make.

Solution

The above error has been solved in this pr

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

The above is the detailed content of Update go-client using OpenAPI generator. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!