OpenApi generator generates client APIs with placeholder in the path get URISyntaxException

579 views Asked by At

I am working on a Java Project with Maven, SpringBoot and OpenAPI. In the pom.xml, we added plugin of openapi-generator-maven-plugin version 5.2.1

In the openapi yaml file we have path like below as an example: "api/v1/companies/{companyId}/employees"

The plugin works and we have the client api (EmployeeApi.java) generated. But when I use this generated api to call, I got an URISyntaxException. With debug I localed the issue happens on the line of UriBuilder uriBuilder = UriBuiler.fromUri(this.apiClient.getBasePath() + "/api/v1/companies/{companyId}/employees");

And it complains the error is the incorrect character of "{"

I noticed the call of UriBuilder.fromUri() will eventually create the URI object by new URI(str) so it cannot take "{" as a valid path. My question is I have no control of the generated codes, how could we ask the generator to use UriBuilder.fromResource or something else which could make this working?

Thanks

1

There are 1 answers

0
Ran On

We decided to use one of "resttemplate", "rest-assure" or "apache-httpclient" instead of google-api