[Java] InputStream is preferable to File from oas v3 with format binary
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Run the shown Maven build and jaxrs-jersey generation command with the linked OpenAPI YAML. Compare the generated testsapi.java and testsapiservice.java examples, then trace the Java generator path that maps binary request bodies. Done means generated code uses InputStream instead of File without breaking the generated API and service output.
Written by the indexing model from the issue text.
Description
Description
Currently, File type is employed in generated codes from oas v3 with format binary.
I think InputStream type is more suitable for it.
I locally test with jersey, and found that jersey accepts File type as request body entity, but it internally writes the binary stream to local disk, and passes the wrote file to the resource class argument.
It is not good for performance, so I think we should change type into InputStream
openapi-generator version
current master (abe741f)
OpenAPI declaration file content or url
https://gist.github.com/fujigon/dd00a99b79a2bc811761b29e63e08a39#file-openapi-yaml
Command line used for generation
# git clone, etc
mvn package
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i openapi.yaml -g jaxrs-jersey
Steps to reproduce
execute the command, and it successfully runs.
I get
- https://gist.github.com/fujigon/dd00a99b79a2bc811761b29e63e08a39#file-generated_testsapi-java
- https://gist.github.com/fujigon/dd00a99b79a2bc811761b29e63e08a39#file-generated_testsapiservice-java
and so on.
Related issues/PRs
Suggest a fix/enhancement
https://github.com/fujigon/openapi-generator/tree/feature/fix-primitive-type-resolve
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
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.
More from OpenAPITools/openapi-generator
-
Issue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenAPITools/openapi-generator#24859 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
OpenAPITools/openapi-generator#24852 · 1 comment ·
-
[BUG][KOTLIN] Fails to compile after updating to 7.25.0 with useJackson3=false useSpringBoot4=true OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
OpenAPITools/openapi-generator#24842 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
OpenAPITools/openapi-generator#24830 ·
-
Issue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenAPITools/openapi-generator#24816 · 1 comment ·
All issues in OpenAPITools/openapi-generator
Similar issues
-
Bug Java Platform: Java
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-java#6138 · 1 comment ·
-
bug needs triage p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100