OpenAPITools / OpenAPITools/openapi-generator
apache-httpclient library generates code that does not compile
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Using the attached precisely openapi schema the apache-httpclient library generates this code that does not compile.
if (getCosts() != null) {
joiner.add(getCosts().toUrlQueryString(prefix + "costs" + suffix));
}
The above happens in the RouteResponse & TravelBoundary classes. It is failing because getCosts() returns an array, the code does not handle arrays only single objects.
PreciselyAPIs_OpenAPI.zip
Using the attached fanniemae openapi schema the apache-httpclient library generates this code that does not compile.
for (String _item : getAllow()) {
try {
joiner.add(String.format("%sallow%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
The above happens in both the HttpHeaders & the ResponseEntityHeaders class.
Income_Limits_API.json
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating the apache-httpclient client with the attached PreciselyAPIs_OpenAPI.zip and Income_Limits_API.json schemas, then inspect the generated RouteResponse, TravelBoundary, HttpHeaders, and ResponseEntityHeaders classes. Trace the generated query-string code for array-valued fields and verify the generated client compiles for both schemas. Done means the reported array cases no longer produce uncompilable Java code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100