OpenAPITools / OpenAPITools/openapi-generator
[BUG][Java] `$ref` with `multipart/form-data` is always null
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- 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 allto compile and run the docker image. - Test the APIs run at http://localhost:8080/v1.
test1is not working. For comparison,test2andtest3are working.
Related issues/PRs
N/A
Suggest a fix
N/A
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 with the linked openapi-test repository and its api.yaml; run the Makefile's make all in Docker and compare test1 with test2 and test3 at localhost:8080/v1. Done when the generated Java behavior for the $ref multipart/form-data case matches the working non-reference cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100