CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

cds-swagger-ui-express

Serves a CAP service's OpenAPI definition as a browsable Swagger UI, which is the page @cap-js/openapi's document does not come with.

Facts

Latestv0.11.0ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
OpenAPICAPOpenAPIcapabilityHanding a description of the service to clients and tools — an API portal, a code generator, a partner who wants a contract before they write anything.
Flavors
Requires
@sap/cds≥ 7@sap/cdsartifactThe peer range, as published.

Who is behind it

Christian GeorgiChristian GeorgiPersonMaintains this
In the atlas: maintains 1, contributes to 53
@chgeo
maintainerbandlowPersonContributes to this
In the atlas: contributes to 1
@bandlow
Daniel HutzelPersonContributes to this
In the atlas: contributes to 32, wrote 3
@danjoa
Gregor WolfPersonContributes to this
In the atlas: maintains 17, contributes to 59, wrote 2
@gregorwolf
Yannick WinterPersonContributes to this
In the atlas: contributes to 1
@kyc3
4 contributors

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
Independently maintained

As a CDS plugin

Declared for
>=7
Distributed through
npm

Connections1

cds-swagger-ui-express connectionscds-swagger-ui-expressPROVIDES→ provides1provides authoredOpenAPI

Install

npm add cds-swagger-ui-express

Derived from the package name. No recipe recorded; the README has the configuration.

Learn more2

Readings
  1. Part 2 – Empowering SAP BTP CAP Services through Open API Spec and Annotations for Effective Communication, Collaboration and Governancemohit_bansal3, SAP Community
  2. Adding a Swagger UI to Your SAP Cloud Application Programming Model / Node.js ServiceThomas Jung, SAP Community

README

quoted from chgeo/cds-swagger-ui-express under MIT, read
chgeo/cds-swagger-ui-express/README.mdOn GitHub

cds-swagger-ui-express

An CAP plugin to serve OpenAPI definitions for CAP services in Swagger UI. Builds on top of swagger-ui-express.

Preview

Setup

In your project, just add a dependency like so:

npm add --save-dev cds-swagger-ui-express

Once loaded by CAP, the package registers itself as a middleware with a default configuration.

Run

After starting the app with cds watch or so, Swagger UI is served at /$api-docs/<service-path>, like http://localhost:4004/$api-docs/browse/

Configuration

You can set the most prominent options in package.json or .cdsrc.json, as in other CAP apps:

"cds": {
  "swagger": {
    "basePath": "/$api-docs", // the root path to mount the middleware on
    "apiPath": "/", // the root path for the services (useful if behind a reverse proxy)
    "diagram": true, // whether to render the YUML diagram
    "odataVersion": "4.0" // the OData Version to compile the OpenAPI specs. Defaults to 4.01
  }
}

To disable the plugin, set this:

"cds": {
  "swagger": false
}

Note that you can also set environment variables for each option, like CDS_SWAGGER=false. See the cds.env docs for more.

Programmatic Usage (advanced)

If you need to register the plugin programmatically, e.g. in certain conditions only, you can do so in your server.js:

const cds = require ('@sap/cds')
const cds_swagger = require ('cds-swagger-ui-express')
cds.on ('bootstrap', app =>
  app.use (cds_swagger ())
)

In this case, the default 'auto registration' as plugin is disabled automatically to avoid conflicts.

Programmatic Configuration

If the middleware is registered programmatically, you need to pass in the options through the API as well. No configuration from package.json is used here.

Call cds_swagger ({...}) with the following object as first parameter:

{
  "basePath": ...,
  // see section above for more
}
Swagger UI Options

Call cds_swagger ({...}, {...}) with an additional object as second parameter. This object is passed to swagger-ui-express as custom options.

Example:

{
  "customSiteTitle": "My Custom Title",
  "swaggerOptions": {
    "requestInterceptor": ...
  }
}

See the list of all options. For questions to specific properties, contact the maintainers of swagger-ui-express or swagger-ui.

Notes

If you call cds.serve on your own in your server.js, make sure to install this middleware before, as it relies on CDS' serving events.

MIT, read

History

Latest

v0.11.1

Fixes

Notes
Fixed
  1. v0.11.0

    Changed 3, Fixes 1

    Notes
    Changed
    • Options from package.json now get used as defaults even if the middleware is added programmatically. You can now call it w/o options but have them in package.json only, or mix them, with the programmatic options taking precedence.
    • Default texts have changed and are now more configurable through
      • @title for service title
      • @Core.Description for service short text
      • @Core.LongDescription for service description
    • This plugin is no longer tested with Node 18, which has reached end of life.
    Fixed
    • Compatibility with express 5, as @sap/cds >= 9.7.0 supports it now.
  2. v0.10.0

    Features 1, Changed 1

    Notes
    Added
    • The OpenAPI spec is no available for download on .../openapi.json and linked in the UI.
    Changed
    • The default value for option apiPath is now /, allowing more flexible control over the root path where the CDS services are served. Formerly, it was not possible to set root path relative to the current host, like abc.com/1234-appid/$api-docs/..., abc.com/5678-appid/$api-docs/....
  3. v0.9.0

    Changed 1

    Notes
    Changed
    • Use @cap-js/openapi instead of @sap/cds-dk, leading to lighter dependencies
  4. v0.8.0

    Features 3, Changed 1

    Notes
    Added
    • Auto-registration mode: the middleware registers itself when loaded as a CAP plugin
    • Declarative configuration through package.json / cds-rc.json
    • Programmatic registration is still possible, but disables auto mode then
    Changed
    • Make dependency to @sap/cds-dk optional. If running with the cds executable during development, the dependency is fulfilled anyways. Only when running as part of a deployed app with cds-serve, then such a dependency is needed.
  5. v0.7.0

    Features 1, Changed 4, Fixes 1

    Notes
    Changed
    • Requires @sap/cds ^7
    • Requires @sap/cds-dk ^7
    • Requires swagger-ui-express / swagger-ui ^5
    • Drops Node 14 and 16 support. Minimum Node version is now 18.
    Added
    • New option odataVersion to specify the OData version used to compile the OpenAPI specs
    Fixed
    • Works with @sap/cds 7.4 again
  6. v0.6.0

    Features 2, Changed 2, Fixes 1

    Notes
    Added
    • Way to pass swagger (UI) options. See README.md.
    • JSDoc type definitions for options.
    Changed
    • The default site title is now <Service Name> - Swagger UI (instead of just Swagger UI)
    • REST services are now available as well in the Swagger UI. Previously, only OData services were allowed. This was to avoid potential issues as the underlying OpenAPI transformation uses OData as intermediate protocol. So, as long as we don't see issues, allow REST services as well.
    Fixed
    • Multiple services are now properly served, w/o the previous stale content of swagger-ui-init.js. Requires swagger-ui-express >= 4.6.2
  7. v0.5.0

    Features 1

    Notes
    Added
    • Option apiPath to configure a root URL path for the services, which is useful if behind a reverse proxy.
  8. v0.4.0

    Changed 2

    Notes
    Changed
    • The Preview text on index page has been added to accomodate the change in @sap/cds-dk 4.9.0 that removes that text suffix.
    • Require @sap/cds-dk@^4.9.0
  9. v0.3.0

    Changed 1

    Notes
    Changed
    • The serving Swagger UI... log lines are not longer sent to console by default to avoid clutter in the default output. They can be enabled with DEBUG=swagger set as environment variable.
  10. v0.2.0

    Changed 1, Fixes 1

    Notes
    Changed
    • Requires @sap/cds-dk 4.3.0, no more polyfill for older versions
    Fixed
    • Options can be provided partially
  11. v0.1.1

    Changed 1

    Notes
    Changed
    • Readme, sample code
  12. v0.1.0

    Features

    Notes
    Added

    Initial release

2,768downloads per week, npm
Weekly downloads for cds-swagger-ui-express26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 2768.27 Apr – 3 May: 7,8014 May – 10 May: 9,85511 May – 17 May: 9,54018 May – 24 May: 11,78025 May – 31 May: 11,9291 Jun – 7 Jun: 6,2858 Jun – 14 Jun: 10,34915 Jun – 21 Jun: 13,41722 Jun – 28 Jun: 9,63829 Jun – 5 Jul: 12,2346 Jul – 12 Jul: 12,65513 Jul – 19 Jul: 13,71320 Jul – 26 Jul: 15,16727 Jul – 2 Aug: 13,7133 Aug – 9 Aug: 13,81310 Aug – 16 Aug: 11,70917 Aug – 23 Aug: 14,44224 Aug – 30 Aug: 13,67331 Aug – 6 Sept: 11,2177 Sept – 13 Sept: 9,85814 Sept – 20 Sept: 10,67921 Sept – 27 Sept: 9,96628 Sept – 4 Oct: 11,2325 Oct – 11 Oct: 9,25412 Oct – 18 Oct: 6,24519 Oct – 25 Oct: 2,768
OpenAPI
  1. abap-openapiGenerates ABAP client classes and server stubs from OpenAPIfrom ABAP
  2. @cap-js/openapiGenerates OpenAPI documents from a CDS servicefrom CAP
  3. ABAP OpenAPI UISwagger UI for SAP NetWeaver Gateway servicesfrom ABAP
  4. ABAP-SwaggerExposes ABAP class methods as REST services with Swagger UIfrom ABAP

Details

Sources5
npm registrydiscovered herechecked
The discovery passdiscovered herechecked
npm registry, cds-swagger-ui-expressversion, releases, installschecked
github.com/git+https://github.com/chgeo/cds-swagger-ui-express.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
declared for>=7
latestv0.11.0
first release
releases and cadence12, ~179d median
discovered vianpm registry, The discovery pass
first seen in the atlas
ecosystem and domaincap, protocols-and-apis
Flavors1
Node.js
“const cds = require ('@sap/cds')” — chgeo/cds-swagger-ui-express — READMEchecked
Contributors4

From the repository’s contributor list, .

History in the atlas2
  1. Serves a CAP service's OpenAPI definition as a browsable Swagger UI, which is the page @cap-js/openapi's document does not come with.
  2. First seen.
For your agent
Ref
artifact:chgeo-cds-swagger-ui-express
JSON
/artifacts/chgeo-cds-swagger-ui-express.json
MCP
Connecting an agent