openapi-generator
openapi-generator copied to clipboard
[BUG][Java] `$ref` with `multipart/form-data` is always null
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)?
- [ ] 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
As titled, when a property is referenced using $ref
with multipart/form-data
in the requestBody, such property is always null. It works otherwise when not using $ref
, or when not using multipart/form-data
. This issue might only occur with the above combinations.
openapi-generator version
I tested with docker images of openapi-generator-cli v5.2.0 and v5.4.0. Both have the same issue. I couldn't test with the latest docker images v6.0.1. The server gives HTTP error 503 for all requests and refuses to work. This is also the reason why I couldn't test with the latest master. (This would be another issue.)
OpenAPI declaration file content or url
For the source codes to reproduce the issue, please refer to this repo: https://github.com/jeffshee/openapi-test The OpenAPI declaration file can be found here: https://github.com/jeffshee/openapi-test/blob/master/api.yaml
Generation Details
Steps to reproduce
Docker environment is required for using the Makefile provided in the repo.
- Clone the repo.
- Execute
make all
to compile and run the docker image. - Test the APIs run at http://localhost:8080/v1.
test1
is not working. For comparison,test2
andtest3
are working.
Related issues/PRs
N/A
Suggest a fix
N/A
Hi, how is this issue going? Do you need any additional info?
Tried out using a workaround from https://github.com/OpenAPITools/openapi-generator/issues/10415#issuecomment-1003067496 and it fixes the issue.
@RomioSahoo Thanks. Did you tried the workaround with the test source code that I provided above?
I tried adding the option --global-property skipFormModel=true
to the generator and it didn't fix the issue.