Custom route api documentation

System Information
  • Strapi Version: “4.4.3”
  • Operating System:
  • Database: “postgres”
  • Node Version: “v16.15.0”
  • NPM Version: “8.5.5”
  • Yarn Version:

Added custom routes test
created test.json => src\api\test\documentation\1.0.0\overrides\test.json

{
  "openapi": "3.0.3",
  "info": {
    "title": "JSONPlaceholder",
    "description": "Fake Online REST API for Testing and Prototyping",
    "version": "0.0.1"
  },
  "paths": {
    "/testing": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fo": "string"
                  }
                }
              }
            },
            "tags": "Test",
            "parameters": [],
            "operationId": "get/domain-details"
          }
        }
      }
    }
  }
}

Added this json but its not showing up in swagger

Hello,
Hope you are doing. Did you find any solution as i m facing same issue

I am also trying to figure out how to generate the documentation for my custom route using the Strapi documentation plugin. When adding the routes folder it doesn’t seem to add the endpoint to the swagger doc. Any news on this topic?

1 Like