swagger-api / swagger-api/swagger-ui

Is there a way to disable/hide an endpoint in swagger file (json/doc/yamlConfig)?

Open
#6,007 13 comments 25 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: question
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Hi,

I have generated a Swagger for an API consisting of both internal and external methods. The internal methods should not be consumed by external clients, and thus not exposed in my API Gateway afterwards.

I want to expose to my gateway just a white list of controllers/actions, I thought to update the swagger json/yaml config like this for example:

"paths": {
    "/api/BankAccountApi/GetBankAccount": {
           "post": {
                 "tags": [
                     "internal"
                   ],
                   "hidden": true // this what I'm looking for

Is there a way to remove/hide/disable certain methods from swagger specification? Any annotations we could use, to flag methods as private or public or any alternative?

Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue mentions Swagger/OpenAPI paths and a proposed hidden field, but identifies no repository file, test, or entry point. Start by determining whether endpoint filtering belongs in Swagger UI or the specification generator; done would require a clearly documented and tested way to exclude selected operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.