How to hide extra endpoints in documentation plugin auto generated for an extension

I am trying ot remove extra endpoints in my API documentation generated using documentation plugin (Introducing the API Documentation (Swagger) Plugin)

Currently, the config of documentation plugin looks like (below is snippet from extensions/documentation/config/settings.json)

"x-strapi-config": {
  "path": "/documentation",
  "showGeneratedFiles": true,
  "pluginsForWhichToGenerateDoc": [
    "users-permissions"
  ]
},

This produces the above documentation for user-permissions plugin.

I created extensions/users-permissions/documentation/1.0.0/overrides/users-permissions-User.json with following code

{
    "paths": {
      "/auth/local": {
        "post": {
          "deprecated": false,
          "description": "Login a user using the identifiers email and password",
          "responses": {
            "200": {
              "description": "response",
              "content": {
                "application/json": {
                  "schema": {
                    "properties": {
                      "foo": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "403": {
              "description": "Forbidden",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            },
            "404": {
              "description": "Not found",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            },
            "default": {
              "description": "unexpected error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            }
          },
          "summary": "",
          "tags": [
            "Auth & User"
          ],
          "requestBody": {
            "description": "",
            "required": true,
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "foo": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "/users/me": {
        "get": {
          "deprecated": false,
          "description": "Retrieve the logged in user information",
          "responses": {
            "200": {
              "description": "response",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/UsersPermissionsUser"
                  }
                }
              }
            },
            "403": {
              "description": "Forbidden",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            },
            "404": {
              "description": "Not found",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            },
            "default": {
              "description": "unexpected error",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/Error"
                  }
                }
              }
            }
          },
          "summary": "",
          "tags": [
            "Auth & User"
          ],
          "parameters": []
        }
      }
    },
    "components": {
      "schemas": {
        "UsersPermissionsUser": {
          "required": [
            "id",
            "username",
            "email"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "username": {
              "type": "string",
              "minLength": 3
            },
            "email": {
              "type": "string",
              "minLength": 6
            },
            "provider": {
              "type": "string"
            },
            "confirmed": {
              "type": "boolean",
              "default": false
            },
            "blocked": {
              "type": "boolean",
              "default": false
            },
            "role": {
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "permissions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "users": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "created_by": {
                  "type": "string"
                },
                "updated_by": {
                  "type": "string"
                }
              }
            },
            "categories": {
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "products": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "published_at": {
                  "type": "string"
                },
                "created_by": {
                  "type": "string"
                },
                "updated_by": {
                  "type": "string"
                }
              }
            }
          }
        },
        "NewUsersPermissionsUser": {
          "required": [
            "username",
            "email"
          ],
          "properties": {
            "username": {
              "type": "string",
              "minLength": 3
            },
            "email": {
              "type": "string",
              "minLength": 6
            },
            "provider": {
              "type": "string"
            },
            "password": {
              "type": "string",
              "format": "password",
              "minLength": 6
            },
            "resetPasswordToken": {
              "type": "string"
            },
            "confirmationToken": {
              "type": "string"
            },
            "confirmed": {
              "type": "boolean",
              "default": false
            },
            "blocked": {
              "type": "boolean",
              "default": false
            },
            "role": {
              "type": "string"
            },
            "categories": {
              "type": "string"
            },
            "created_by": {
              "type": "string"
            },
            "updated_by": {
              "type": "string"
            }
          }
        }
      }
    },
    "tags": [
      {
        "name": "Auth & User"
      }
    ]
  }

This creates a new tag and required endpoints in new tag but how to remove UsersPermissions - Role and UsersPermissions - Users completely

I want to

  • Remove UsersPermissions - Role completely
  • Have only /auth/local and users/me in UserPermssions - Users
System Information
  • Strapi Version: 3.3
  • Operating System: Mac OS 10.15.7
  • Database: Postgres
  • Node Version: 12.6
  • NPM Version: 6
  • Yarn Version: 1.2

1 Like