Open wizofaus opened 4 years ago
Only Application/JSON and Multipart/form-Data are implemented
Are you happy for me to contribute a fix? Intention would be to add an extra string parameter 'content' to the client method (would need to check for an existing such param obviously).
This is still something I believe swagger codegen would benefit from, and I was happy to contribute an implementation, but I'd hoped for confirmation that you thought my proposal made sense...
so, what your mean? and codegen result like ?do you provide an example?
Completed untested, but perhaps something like
static validateFile(
content?: string,
options: IRequestOptions = {},
): Promise<ValidateFileResponse> {
return new Promise((resolve, reject) => {
let url = '/v1/validateFile'
const configs: IRequestConfig = getConfigs('post', 'text/plain', url, options)
configs.data = content
axios(configs, resolve, reject)
})
}```
look forward to you submit full example
@wizofaus please feel free to join the discussion: https://github.com/Manweill/swagger-axios-codegen/pull/180
@wizofaus There is a new release which should solve your issue with plain text: https://github.com/Manweill/swagger-axios-codegen/releases/tag/v0.16.0
Please feel free to test it and close this issue if you are happy.
Don't really see how it generates a client-stub that will actually support uploading the plain-text content, but I haven't tried TBH. Do plan to start using this tool again soon actually so will let you know.
We have a couple of APIs for uploading documents, that in our swagger look like, e.g.:
But the function generated by swagger-axios-codegen has
i.e., there's no way to pass in the actual contents to upload to the API!
Again, I could look at contributing a fix, but is this something you'd come across before?
We also have some APIs that require application/octet-stream as the input (binary file uploads).
Thanks!
Dylan