question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger expose "/documentation/*" endpoint

See original GitHub issue

Hi, i have an issue that i dont know if to others happend but in swagger is loading the /documentation/* endpoint, i resolve if i ask in the fastify-swagger plugin by the condition in dynamic:

if (route.path === 'documentation/*' || route.schema && route.schema.hide)

but i dont know if is the correct way because maybe someone just resolvered.

This is the json that swagger generates with only one endpoint:

{
   "swagger":"2.0",
   "info":{
      "version":"1.0.0",
      "title":"API Documentation",
      "description":"API Endpoints Documentation"
   },
   "schemes":[
      "https",
      "http"
   ],
   "consumes":[
      "application/json"
   ],
   "produces":[
      "application/json"
   ],
   "paths":{
      "/documentation/*":{
         "get":{
            "responses":{
               "200":{
                  "description":"Default Response"
               }
            }
         }
      },
      "/v1/keep-alive":{
         "get":{
            "summary":"Obtain the status of the API",
            "description":"Get the status of the API",
            "tags":[
               "Info"
            ],
            "responses":{
               "200":{
                  "schema":{
                     "description":"Succesful response",
                     "type":"string"
                  },
                  "description":"Succesful response"
               },
               "400":{
                  "schema":{
                     "description":"Not Found response",
                     "type":"string"
                  },
                  "description":"Not Found response"
               },
               "500":{
                  "schema":{
                     "description":"Error response",
                     "type":"object",
                     "properties":{
                        "error":{
                           "type":"string"
                        },
                        "message":{
                           "type":"string"
                        },
                        "statusCode":{
                           "type":"number"
                        }
                     }
                  },
                  "description":"Error response"
               }
            }
         }
      }
   }
}

and this is my config:

{
   "swagger":{
      "info":{
         "version":"1.0.0",
         "title":"API Documentation",
         "description":"API Endpoints Documentation"
      },
      "schemes":[
         "http"
      ],
      "consumes":[
         "application/json"
      ],
      "produces":[
         "application/json"
      ]
   },
   "exposeRoute":true
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mcollinacommented, May 2, 2018

I think we just need to pass schema: { hide: true } to all route definitions in fastify-static. There is no need for a hook.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Documentation Made Easy with OpenAPI & Swagger
Swagger Inspector is an easy to use developer tool to quickly execute any API request, validate its responses and generate a corresponding OpenAPI...
Read more >
RESTful API Documentation Made Easy with Swagger and ...
Swagger and OpenAPI specification lets us design and develop REST APIs in an effortless and seamless manner.
Read more >
Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
Activity: Create a Swagger UI display with an OpenAPI spec document · Go to the Swagger UI GitHub project. · Click Clone or...
Read more >
Swagger: How to Create an API Documentation - YouTube
A good documentation is crucial for any REST API. Swagger is a tool that can help in both creating and displaying such a...
Read more >
Hiding Endpoints From Swagger Documentation in Spring Boot
... look at how we can hide endpoints from Swagger API documentation. ... documentation, we often need to hide endpoints from being exposed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found