GeneratorGeneratortypeCreates a project, a component or configuration once, when you run it, rather than taking part in every build.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 →

cap-mock-generator

Parses the .cds schema and fills db/data with relationally consistent CSV — through an LLM layer where one is configured, or a local engine where none is.

Relational consistency is the claim that separates it from row-count generators: foreign keys line up, so the generated set is navigable rather than merely present. An interactive wizard walks the configuration.

Facts

Latestv1.0.11ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Seed dataCAPSeed datacapabilityGetting realistic data into a service so it can be developed and demonstrated — initial data, per-tenant content, and believable volumes for testing.
Flavors
Node.jsJavafrom its runtime

Who is behind it

BerkayBerkayPersonMaintains this
In the atlas: maintains 1, contributes to 1
@xbergun
maintainer

What it declares

Every artifact

Type
Generator
Origin
Independently maintained
Runtime
build time

As a generator

Generates
does not say
Run with
Its own command
Distributed through
npm

Connections2

cap-mock-generator connectionscap-mock-generatorFUNCTIONAL→ alternative to1alternative to authoredcap-js-mockdata→ provides1provides authoredSeed data

Install

npm add cap-mock-generator

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

README

quoted from xbergun/cap-mock-generator under MIT, read
xbergun/cap-mock-generator/README.mdOn GitHub

CAP Mock Generator

npm version License: MIT

An advanced, interactive, and intelligent mock dataset generation engine built specifically for SAP Business Technology Platform (BTP) Cloud Application Programming Model (CAP) applications.

cap-mock-generator parses your native .cds schemas and populates your db/data/ folder with highly realistic, relationally consistent .csv mock files in seconds, using either a cutting-edge AI Smart Layer or a high-speed Local Fallback Engine.


Features

  • Interactive Onboarding Wizard: Powered by modern @inquirer/prompts, walking you seamlessly through configuration step-by-step.
  • Relational Data Integrity (Foreign Key Management): Automatically analyzes dependencies. It ensures child tables (e.g., entity relationships ending with ID) match valid, existing primary keys generated from parent tables.
  • Automatic Virtual Column Stripping: Cleanly filters out Association to many and Composition of many virtual elements so they never mess up your physical CSV deployment files.
  • Multi-Provider AI Data Layer: High-fidelity business mock data using either Google Gemini Pro (gemini-2.5-flash) or OpenAI (gpt-4o-mini) structured JSON responses.
  • Resilient Fallback Core: If your AI API tokens hit limit caps or encounter network spikes (503 Service Unavailable), the engine gracefully falls back to a lightning-fast local Faker.js cluster without crashing.
  • Clean Architectural Foundations: Designed around the Command-Service pattern for maximum scalability and maintainability.

Installation

You can install cap-mock-generator globally, locally as a development dependency, or invoke it instantly on-demand using npx.

1. Global Installation

Quickest access across any project workspace:

npm install -g cap-mock-generator
2. Local Installation

Recommended for engineering team standardization.

Install it directly as a development dependency inside your specific SAP CAP project root directory:

npm install cap-mock-generator --save-dev

Usage

Once installed, open your terminal, ensure you are in the root directory of your SAP CAP application where your package.json and db/ folder reside, and trigger the wizard using one of the strategies below.

Option A: On-The-Fly Execution

No installation required.

If you prefer to run the module directly without explicitly downloading it to your machine, use npx:

npx cap-mock-generator start
Option B: Global Command Line Execution

If you selected the global installation strategy earlier, simply ignite the interface by typing:

cap-mock-generator start
Option C: Configured Local Project Scripts

If you installed the generator locally, open your native package.json and map a clean entry shortcut helper to your internal scripts block:

{
  "scripts": {
    "mock:gen": "cap-mock-generator start"
  }
}

Now, any team member working on the repository can securely refresh testing data vectors by executing:

npm run mock:gen

Interactive Onboarding Flow

When you ignite the CLI wizard, it will guide you through the following prompts:

🌟 --- CAP Mock Generator Onboarding Wizard ---

? Enter your CDS schema filename inside the "db" directory: (schema.cds)
? How many mock records should be generated per Entity? (5)
? Do you want to enable the AI smart data layer engine? (Yes/No)
? Select your preferred AI Provider target: (Gemini (Google) / OpenAI (GPT))
? Provide your secret authorization API Key: ***********************

⚙️ Processing schema and initializing execution...
🔍 Analyzing model artifacts...

📦 Processing Entity: [sap.btp.assetmanagement.Plants]
🤖 Generating smart context data via Gemini...
✅ CSV successfully exported to: .../db/data/sap.btp.assetmanagement.Plants.csv

📦 Processing Entity: [sap.btp.assetmanagement.Assets]
🤖 Generating smart context data via Gemini...
✅ CSV successfully exported to: .../db/data/sap.btp.assetmanagement.Assets.csv

✨ Execution successfully completed! Check your db/data directory. 😎

Security & Environment Compliance

Your secret API credentials, such as GEMINI_API_KEY or OPENAI_API_KEY, are processed strictly inside your immediate shell execution context memory through process.env.

They are never saved to disk, logged to the console, or transported outside the official provider endpoint requests.


Relational Schema Topology

The generator intelligently tracks schema hierarchy. Take this complex manufacturing scenario:

entity Plants {
    key ID   : UUID;
    name     : String(100);
}

entity Assets {
    key ID      : UUID;
    plantID     : UUID; // Foreign Key referencing Plants
    name        : String(100);
}

License and Usage Notice

This library leverages the official @sap/cds-compiler package provided by SAP to parse CDS schema definitions for SAP CAP applications. It does not modify, bundle, or redistribute SAP source code beyond declaring @sap/cds-compiler as an npm dependency.

The @sap/cds-compiler package is provided under SAP's own license terms. Users of cap-mock-generator are responsible for reviewing and complying with the applicable SAP license terms when using this package in projects that depend on SAP CAP tooling.

Careful attention should be paid to licensing restrictions when integrating cap-mock-generator into commercial, enterprise, or redistributed software that includes SAP CAP dependencies.

cap-mock-generator itself is licensed under the MIT License. See the LICENSE file for details.

MIT, read

History

Latest

v1.0.11

  1. v1.0.10

  2. v1.0.9

  3. v1.0.8

  4. v1.0.7

  5. v1.0.6

  6. v1.0.5

  7. v1.0.3

  8. v1.0.2

  9. v1.0.1

  10. v1.0.0

On npm
1downloads per week, npm
Weekly downloads for cap-mock-generator26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 1.20 Apr – 26 Apr: 027 Apr – 3 May: 04 May – 10 May: 011 May – 17 May: 018 May – 24 May: 025 May – 31 May: 01 Jun – 7 Jun: 08 Jun – 14 Jun: 1,50015 Jun – 21 Jun: 3222 Jun – 28 Jun: 1629 Jun – 5 Jul: 666 Jul – 12 Jul: 7413 Jul – 19 Jul: 1920 Jul – 26 Jul: 1727 Jul – 2 Aug: 23 Aug – 9 Aug: 1410 Aug – 16 Aug: 3617 Aug – 23 Aug: 924 Aug – 30 Aug: 831 Aug – 6 Sept: 37 Sept – 13 Sept: 2014 Sept – 20 Sept: 521 Sept – 27 Sept: 428 Sept – 4 Oct: 55 Oct – 11 Oct: 212 Oct – 18 Oct: 1
Declared alternative
  1. cap-js-mockdataCSV seed data generated from @Mockdata annotations with Faker
Seed data
  1. @animb1996/cds-data-driftCompares a CAP project's CSV data with its database rowsfrom CAP
  2. cap-js-mockdataCSV seed data generated from @Mockdata annotations with Fakerfrom CAP
  3. @sap/cds-common-contentISO content for CAP's countries, languages, currencies and timezonesfrom CAP
  4. @sap/cdsCAP Node.js runtimefrom CAP
  5. abapFakerFake data generator for ABAPfrom ABAP

Details

Sources4
npm registrydiscovered here, keywords:cdschecked
npm registry, cap-mock-generatorversion, releases, installschecked
github.com/git+https://github.com/xbergun/cap-mock-generator.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
runtimesbuild-time
latestv1.0.11
first release
releases and cadence11, ~0d median
discovered vianpm registry · keywords:cds
first seen in the atlas
ecosystem and domaincap, developer-experience
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:xbergun-cap-mock-generator
JSON
/artifacts/xbergun-cap-mock-generator.json
MCP
Connecting an agent