Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2733
Closed
Open
Issue created Apr 24, 2019 by Administrator@rootContributor

[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' }
Assignee
Assign to
Time tracking