cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
403 stars 134 forks source link

Content-Type: application/json missing from multipart/form-data #280

Closed keygjones closed 1 year ago

keygjones commented 1 year ago

Hi,

Looks like the generated request is missing the application/json content type from the request, or a lack of developer knowledge on my behalf?

Below is our relevant api fragment and before ng-openapi-gen and after requests.


 post:
      description: Legger til et Vedlegg i en allerede opprettet Dokumentflyt
      summary: Legg til nytt Vedlegg
      tags:
        - Vedlegg
      operationId: addVedlegg
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                vedlegg:
                  $ref: "#/components/schemas/Vedlegg"
                file:
                  type: string
                  format: binary
              required:
                - 'vedlegg'
                - 'file'
            encoding:
              vedlegg:
                contentType: application/json

Before using ng-openapi-gen ------WebKitFormBoundaryISTkoycUv3GBjpX5 Content-Disposition: form-data; name="metadata"; filename="blob" Content-Type: application/json

{"filnavn":"1080x1920Promotion (1).jpg","post":"INNGAENDE","dokumenttype":"OPPSIGELSE_AV_LEIEFORHOLD","datoMottatt":"2023-08-08","skalArkiveres":false,"erEksisterendeForsendelse":false}

------WebKitFormBoundaryISTkoycUv3GBjpX5

Content-Disposition: form-data; name="file"; filename="1080x1920Promotion (1).jpg" Content-Type: image/jpeg

------WebKitFormBoundaryISTkoycUv3GBjpX5--

Using ng-openapi-gen

------WebKitFormBoundarytCuj2Kyoj8VHL8xV Content-Disposition: form-data; name="vedlegg"

{"tittel":"1080x1920Promotion (1).jpg","kategori":"FULLMAKT","egenref":"1","id":"grunnlan"}

------WebKitFormBoundarytCuj2Kyoj8VHL8xV

Content-Disposition: form-data; name="file"; filename="1080x1920Promotion (1).jpg" Content-Type: image/jpeg

------WebKitFormBoundarytCuj2Kyoj8VHL8xV--