knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
15.38k stars 1.4k forks source link

OpenApi Body Content Missmatch on Sub-Import #2163

Closed dylancetin closed 12 hours ago

dylancetin commented 1 week ago

Version:

Description of the bug and steps to reproduce: Miss match OpenApi specs on /import/subscribers POST

Current OpenApi spec is:

  /import/subscribers:
    ...
    post:
      description: handles the uploading and bulk importing of a ZIP file of one or more CSV files.
      operationId: importSubscribers
      tags:
        - Import
      requestBody:
        description: uploads and bulk imports of compressed CSV files
        content:
          application/json:
            schema:
              type: object
              properties:
                params:
                  type: string
                file:
                  type: string
      ...

But as far as I am aware, body should be "multipart/form-data" or "application/x-www-form-urlencoded" to be able to transmit files. I have a copy of the yaml that I modified like below. And I am using this modified yaml to generate typescript clients.

I would love to dive in the Go code, but I am not familiar. I will be guessing this is a bug.

  /import/subscribers:
    ...
    post:
      description: handles the uploading and bulk importing of a ZIP file of one or more CSV files.
      operationId: importSubscribers
      tags:
        - Import
      requestBody:
        description: uploads and bulk imports of compressed CSV files
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                params:
                  type: string
                  description: JSON string containing import parameters
                file:
                  type: string
                  format: binary
      ...
dylancetin commented 1 week ago

Something similar exists in "/lists" GET. OpenApi says search query string should be in the body json. But it only works when I add it on to URL params.

dylancetin commented 1 week ago

Similar things mentioned in #2077

knadh commented 3 days ago

Hi @dylancetin. Would you be able to send a PR fixing the YML spec?

dylancetin commented 2 days ago

@knadh opened one