-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java/RestTemplate - Allow flexible options in generated client when a file is needed #6715
Comments
@wing328 Can you please start the discussion or assign to / tag relevant engineers? Thanks. |
As discussed, it looks reasonable to me to add another option to meet the requirement. Please go ahead to submit a PR and we'll review the change accordingly. |
…va/RestTemplate to allow flexible options in generated client when a file is needed.
…va/RestTemplate to allow flexible options in generated client when a file is needed.
…llow flexible options in generated client when a file is needed (OpenAPITools#6715)
…llow flexible options in generated client when a file is needed (OpenAPITools#6715)
…llow flexible options in generated client when a file is needed (OpenAPITools#6715)
…llow flexible options in generated client when a file is needed (OpenAPITools#6715)
…va/RestTemplate to allow flexible options in generated client when a file is needed.
* Fix dir path in PR request template * Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715) * Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715) * Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed (#6715) * #6715 - Add "useAbstractionForFiles" config option for Java/RestTemplate to allow flexible options in generated client when a file is needed.
Hello, Is there documentation on how this is used? I am using gradle and have done the following: Added this to my dependencies:
Updated our generator:
And added this option to the configOptions:
However, the method signature still returns a File:
Thanks for adding this feature! |
Hi, The feature is not included in 5.0.0-beta and will be included in 5.0.0-beta2 that is expected to be released in 30.07.2020. |
This is a good idea, but is there a reason for not using the interface Resource instead of AbstractResource ? PS: just tried with a custom template using Resource and it works as expected. Always prefer interfaces :) |
Good question :-). No good reason except it was just missed. I will change it to Resource soon. Thanks! |
…e when useAbstractionForFiles=true.
It seems like this option should be present for the webclient generator as well. |
How can I use this with the command line? This is not working: |
@sblumenstock-doubleSlash Because this is a config option, I believe you should use the
More details here: https://openapi-generator.tech/docs/usage/#additional-properties |
Ahh thank you! :) |
Is this only implemented when uploading a file? |
It is currently implemented for uploading files. That was my immediate need. Agree that it will be useful to get an InputStream (or similar) when downloading as well. I don't have time to do it now but maybe in the future. If it is important for you, please feel free. |
I tried to solve it by myself, but I got an issue. |
How can I check if the |
Hi,
I have an API that requires a org.springframework.web.multipart.MultipartFile parameter (Swagger 2.0 API spec is below).
I am using generatorName=java and library=resttemplate to generate the client.
The generated Api client looks like:
I would like to have the option to generate a client that takes an
org.springframework.core.io.AbstractResource
instead of aFile
.The user will be able to pass a
new FileSystemResource(file)
to have same behavior as now but if the user does not have the file on disk, he/she can use anInputStreamResource
or aByteArrayResource
or ... For example:From the source code it seems that there is no such option:
openapi-generator/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/api.mustache
Line 133 in 5cdc9e9
I'm proposing a new configOption (something like "useAbstractionForFiles") and every library can try to support as possible (My first priority is to have the resttemplate library support this).
Swagger 2.0 API spec:
The text was updated successfully, but these errors were encountered: