Skip to content

strapi-plugin-documentation: some settings not overridable #10278

@semiaddict

Description

@semiaddict

Bug report

Describe the bug

There is currently no way to disable some response codes from the generated full_documentation.json by the documentation plugin.
It is however sometimes important to be able to disable some response codes such as 200, it the api route only responds with 204 codes.

It is also impossible to remove a setting from the list of "servers". For example, if there is no staging server, but only a development and a production server, then it is impossible to remove the extra third server, as the settings seem to be deep merged.

Steps to reproduce the behavior

  1. Install the "email" and "documentation" plugins
  2. Override the email documentation via "/extensions/email/documentation/1.0.0/overrides/email-Email.json" replacing the "paths./email/.post.responses" object by removing the existing responses and adding a custom 204 response (see example below).
  3. Regenerate the documentation under "admin/plugins/documentation"
  4. Notice that the 204 response is correctly available under Email - Email > post /email/, but the 200, 403 and 404 are also present.

Expected behavior

The 200, 403 and 404 responses should not be present in the generated documentation.
Another option would be to allow disabling some of the responses by setting then to null.

Screenshots

image

Code snippets

Example contents of "/extensions/email/documentation/1.0.0/overrides/email-Email.json":

{
  "paths": {
    "/email/": {
      "post": {
        "deprecated": false,
        "description": "Send an email",
        "responses": {
          "204": {
            "description": "OK"
          }
        },
        "summary": "",
        "tags": [
          "Email - Email"
        ],
        "requestBody": {
          "description": "",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "foo": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

System

  • Node.js version: 14.16.0
  • NPM version: 7.7.6
  • Strapi version: 3.6.1
  • Database: MongoDB
  • Operating system: Docker

Additional context

This issue is already being discussed in the forums: https://forum.strapi.io/t/how-disable-auto-document-generation-for-specific-url/3014

Metadata

Metadata

Assignees

Labels

status: pending reproductionWaiting for free time to reproduce the issue, or more information

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions