openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][JAVA] APIClient.mustache template for apache-httplient library unnecessarily verifies if method allows request body

Open wojciechkl opened this issue 1 year ago • 1 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Validation code here https://github.com/OpenAPITools/openapi-generator/blob/cf303d4e034ce9d8eb194fb4e37a1f3409814cf9/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache#L1096 prevents me from sending GET request with body data.

I'm using OpenApi version 3.1.0 which explicitly allows to have request body in GET methods.

openapi-generator version

All

Suggest a fix

Remove this validation and leave it for http library to decide if method can have request body.

wojciechkl avatar Jun 19 '24 13:06 wojciechkl

can you please file a PR with the suggested fix?

wing328 avatar Jun 19 '24 13:06 wing328