Visual CAP Inspector
See your SAP CAP CDS model the way you think about it — as a graph, as example payloads, and as database tables — right inside VS Code. Best-practice problems show up in red while you type.
The inspector works on the compiled model (CSN), so it understands everything the CDS compiler understands: includes and aspects, projections, auto-exposed entities, localized texts, drafts, compositions of aspects, and npm workspace monorepos.
Features
Schema
- Every entity, view, aspect, type, action and event of a project as an auto-laid-out graph.
- Cards show keys, fields, types and relations; inherited fields fold away.
- Associations and compositions are drawn from the field that declares them, with cardinality markers (
0..1, *, …). Compositions get a diamond, projections a dashed line, includes a hollow triangle.
- Service groups: everything that belongs to the same service sits in its own pastel frame (toggle in the top bar).
- Click a card for its details, double-click (or Source) to jump to the definition.
- Search and kind filters for large models; imported (
@sap/cds/common) and generated definitions on demand.
Instance Examples
- MIN, MID and MAX example payloads for every entity, compared field by field:
- MIN: keys and mandatory fields with the smallest valid values.
- MID: realistic values, shallow references to related entities, one child per composition.
- MAX: every field at its limit (
String(255) → 255 characters, Decimal(9,2) → 9999999.99, Int64 max, …), deep compositions and associations.
- Read (GET response) and Write (valid POST body) shapes.
- Cells are highlighted where a level adds or changes a value.
- Requests: copy-ready cURL commands for read, create, update, delete, draft activation and bound actions — with the right service path, key predicates and mocked-user credentials.
- Query simulator: build
$select, $expand, $filter, $orderby, $top and $count, preview the response from generated data, or send the request to your running app (cds watch).
DB Tables
- The DDL that CAP generates, for SQLite, SAP HANA, PostgreSQL or H2.
- A table catalog with tables, link tables, localized texts tables, draft tables and views.
- Column grid with physical types, nullability, primary and foreign keys, and the CDS element each column comes from.
- A relations strip that shows the foreign keys going in and out of a table (solid = database constraint, dashed = checked by CAP).
Everywhere
- Live inline editing: open a definition in the side editor and every tab updates while you type. The change goes into your
.cds file (unsaved), so undo and save work as usual.
- Best practices: 45+ checks based on the CAP documentation and the CDS Lint rules (naming, keys, relationships, types, performance, services, security). Findings appear in red on the cards, in a findings drawer and in the Problems panel.
- CodeLens above definitions: Inspect, Examples, and the number of issues.
- The status bar of the inspector shows which
@sap/cds and compiler versions were used.
Requirements
The inspector uses your own installation of @sap/cds. It looks for it in this order:
- the folder in the
capInspector.compiler.path setting,
- the project's
node_modules (also in parent folders and npm workspaces),
- a global installation (
npm i -g @sap/cds-dk),
- a copy you download from npm with the command CAP Inspector: Download CDS Compiler.
The extension does not ship SAP's packages. They are licensed by SAP SE under the SAP Developer License Agreement.
Projects that are not fully installed still work: missing npm workspace packages are linked automatically, and missing packages are replaced by empty placeholders (the inspector tells you which).
Getting started
- Open a folder with a CAP project (or any
.cds file).
- Run CAP Inspector: Open CAP Visual Schema Inspector, click the inspector icon in the editor title bar, or use the CAP Inspector view in the activity bar.
Settings
| Setting |
Default |
Description |
capInspector.compiler.path |
|
Folder of an @sap/cds installation to use. |
capInspector.compiler.nodePath |
|
Node.js for the compile worker (default: VS Code's own runtime). |
capInspector.liveUpdate |
onType |
Recompile while typing, or only on save. |
capInspector.serviceGrouping |
true |
Pastel frames around everything in the same service. |
capInspector.bestPractices.enabled |
true |
Run the best-practice checks. |
capInspector.bestPractices.problemsPanel |
true |
Also show findings in the Problems panel. |
capInspector.bestPractices.disabledRules |
[] |
Rule ids to switch off. |
capInspector.codeLens.enabled |
true |
Show CodeLens above definitions. |
capInspector.server.url |
http://localhost:4004 |
Base URL for cURL commands and the simulator. |
capInspector.server.user |
alice |
Mocked user for services that require authentication. |
capInspector.examples.maxDepth |
3 |
Depth of MAX examples. |
capInspector.examples.collectionSize |
2 |
Items per to-many relation in MAX examples. |
capInspector.db.dialect |
auto |
SQL dialect for the DB Tables tab. |
Privacy
The inspector runs locally. It sends no telemetry. Network requests happen only when you click Send in the query simulator (to the URL you configured) or when you ask it to download @sap/cds from npm.
Disclaimer
Visual CAP Inspector is a community project and is not affiliated with or endorsed by SAP SE. SAP and CAP are trademarks of SAP SE.
License
MIT — see the LICENSE file. Third-party components are listed in THIRD_PARTY_NOTICES.md.
| |