'useAbstractionForFiles OpenAPI WebClient not working
I am using OpenAPI generator (Gradle plugin version 5.4.0) to generate a few API calls. One of said calls, revolves a file download from an external service i.e my application calls that one and downloads and then should proxy the event. For that API call my returned content-type
is set to application-zip
. When invoking that API directly (i.e from a browser) everything works OK.
Using that API definition, I am trying to generate a WebClient to be used by another project that will effectively download that file. Doing so I am facing the following problems:
Whenever I try to invoke the API to download the file I am getting the following error:
nested exception is org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/zip' not supported for bodyType=java.io.File
My generated
WebClient
seems to return aMono<File>
instead of some other object instance. I tried to disable this behavior by setting the following openapi generator configuration optionuseAbstractionForFiles
but is seems to get ignored.
Can anyone shed some light as to how I can resolve this issue? For reference here is my OpenAPI Gradle Plugin configuration options:
configOptions = [
dateLibrary : 'java8',
serializationLibrary : 'jackson',
library : 'webclient',
useAbstractionForFiles : 'true',
useBeanValidation : "true",
interfaceOnly : "true",
serializableModel : "true",
useTags : "true",
reactive : "true",
sourceFolder : 'src/main/java',
testFolder : 'src/test/java'
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|