Why is the documentation extension (OpenAPI) generating the wrong data type?

System Information
  • Strapi Version: 3.6.3
  • Operating System: Alpine linux
  • Database: Postgres
  • Node Version: 14
  • NPM Version: 6
  • Yarn Version:

I’ve defined a single content type called “header” with one text field, and the generated OpenAPI spec defines the response type as being array instead of single object. Why is this? I know I can override the response type, but I will need to do that for every single type I create so it’s rather inconvenient.

Here’s the (incorrect) generated response:

"responses": {
  "200": {
    "description": "Retrieve header document(s)",
    "content": {
      "application/json": {
        "schema": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Header"
          }
        }
      }
    }
  },

1 Like

I have the same problem. Single types are generated as arrays which is just wrong.