[BUG] [angular-typescript] Incorrect JSON object in HTTP request multipart form data
Created by: Beaurpi
Hi there,
I've figured out that there is an issue with the code generated, when using a multipart/form-data object. Declare a POST method with the following requestBody:
'/test/upload':
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
name:
type: string
title:
type: object
properties:
en:
type: string
fr:
type: string
fileName:
type: string
format: binary
It's related to the generated code in angular typescript.
in the generation command line i'm using the following:
-g typescript-angular
the generated service will have a good signature:
public uploadFile(id: string, name?: string, title?: UploadTitle, .....
But the HTTP post, will not pass a JSON for the parameter 'TITLE'. It will actually encode the object as string. As a result the 'title' parameter will be
-----------------------------8302951520691
Content-Disposition: form-data; name="title"
[object: Object]
Instead the parameter title should be
-----------------------------8302951520691
Content-Disposition: form-data; name="title"
{ en: 'sometext', fr: 'loren ipsum' }