cap-js-mockdata
A cds add command that generates CSV seed files into db/data from @Mockdata annotations on your entities, filling each column with values from the Faker module the annotation names.
Turns an empty model into a demonstrable one. cds add mockdata writes a CSV per entity into db/data, with values driven by Faker modules named in the annotation — so names look like names and IBANs like IBANs, rather than every row reading str1.
Facts
Where it sits
Who is behind it
In the atlas: maintains 16, contributes to 41, wrote 4@mauriciolauffermaintainer
Before choosing this
Signals
ActivityQuietRelease and repository quiet for 27 months
Both observable publication channels have been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.
Conditions
PracticalFunctional boundary
Not a test-data factory. It writes files at build time to seed a database, so it does not build fixtures inside a unit test. The declared peer range stops at cds 7 — nothing says it fails on 9, but nothing says it was tried either.
What it declares
Every artifact
- Type
- Generator
- Origin
- Independently maintained
- Runtime
- build timeNode.js
As a generator
- Declared for
- >=7
- Generates
- does not say
- Run with
- cds add
- Distributed through
- npm
Connections
Fills db/data with relationally consistent CSV from a .cds schema
Getting realistic data into a service for development and demos
Download
Install
npm add cap-js-mockdataDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from mauriciolauffer/cap-js-mockdata under MIT, readSAP CAP Mockdata Plugin
A SAP CAP plugin to generate CSV files populated with mock data for testing.
This plugin uses Faker to generate meaningful mock data both automatically and through annotations.
Setup
All you need to do is to install the plugin and add the @Mockdata annotations to your entities.
Installation
Install the plugin as an npm module:
npm i -D cap-js-mockdata
Annotation
The annotation tag is @Mockdata. You can add and combine all valid Faker module APIs.
// db/schema.cds
entity Customers : cuid, managed {
name String @Mockdata: {person: 'fullName'};
sex String @Mockdata: {person: 'sex'};
creditCard String @Mockdata: {finance: 'creditCardNumber'};
phone String @Mockdata: {phone: 'number'};
ipAddress String @Mockdata: {internet: 'ipv4'};
email String @Mockdata: {internet: 'email'};
street String @Mockdata: {location: 'streetAddress'};
country String @Mockdata: {location: 'countryCode'};
};
Using
Once you have installed the plugin and added the annotations, or not, you can execute the following command in a terminal:
cds add mockdata
The cds add mockdata command will create CSV files for every supported CDS Entity. The CSV files will be created into the db/data folder, the filenames will be something like namespace-entityName.csv and their content will look like:
| ID | createdAt | createdBy | modifiedAt | modifiedBy | name | sex | creditCard | phone | ipAddress | street | country | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bef3c7b8-1232-4860-bded-efd51443e508 | Sun Oct 06 2024 15:55:24 GMT-0300 (Brasilia Standard Time) | Julius_Hintz48 | Sun Nov 03 2024 14:38:56 GMT-0300 (Brasilia Standard Time) | Brain_Mosciski | Edgar Langosh | female | 3564-4519-0923-7387 | 801.226.6645 x01258 | 214.155.102.159 | Marcellus.Fritsch@hotmail.com | 640 Bramley Close | Austria |
| 96ac7211-691a-4c2a-8fc0-0ae509693193 | Thu Mar 28 2024 20:32:35 GMT-0300 (Brasilia Standard Time) | Clotilde_DAmore | Thu Nov 23 2023 10:49:44 GMT-0300 (Brasilia Standard Time) | Brendan.Corwin-Schinner | Erica McDermott | male | 6567-6280-8822-5389-0611 | (240) 938-1223 | 37.230.118.100 | Shayne78@gmail.com | 1803 Feeney Park | Cocos (Keeling) Islands |
| 4fc525bc-e22b-4c55-a447-0e4c9fef1ffd | Fri Feb 09 2024 15:21:45 GMT-0300 (Brasilia Standard Time) | Lance78 | Fri Feb 14 2025 05:25:29 GMT-0300 (Brasilia Standard Time) | Donny_Blanda | Joseph Lehner | male | 4686210527760 | 312-939-7109 | 14.207.231.127 | Daija_Oberbrunner94@gmail.com | 79422 Collin Divide | Portugal |
| 872b47a8-0bb1-47af-bc02-ef7290cff633 | Sat Feb 22 2025 01:34:16 GMT-0300 (Brasilia Standard Time) | Mateo22 | Sun Sep 15 2024 18:42:41 GMT-0300 (Brasilia Standard Time) | Myrtle52 | Leigh Wintheiser I | male | 6759-2563-9161-5976 | 553.277.9724 x231 | 10.88.166.234 | Elyssa.Adams79@gmail.com | 139 Park Drive | Macao |
History
Others providing
Compare all 6 on the Seed data page →- cap-mock-generatorcap-mock-generatorParses 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.independent, capFills db/data with relationally consistent CSV from a .cds schema
- @animb1996/cds-data-drift@animb1996/cds-data-driftCompares the CSV files under a CAP project's db/data with the rows in the database bound as its db service, and reports where the two have diverged without writing to either.independent, capCompares a CAP project's CSV data with its database rowsfrom CAP
- @sap/cds-common-content@sap/cds-common-contentISO-standard content for CAP's common definitions — countries, languages, currencies and timezones — so a project does not seed those tables itself.sap official, capISO content for CAP's countries, languages, currencies and timezonesfrom CAP
- @sap/cds@sap/cdsThe CAP Node.js runtime, which compiles the CDS model, serves the services declared in it, answers generic requests before any handler runs, and loads every cds-plugin.sap official, capCAP Node.js runtimefrom CAP
- abapFakerabapFakerGenerates fake data in ABAP, for bootstrapping a database, creating XML documents, stress-testing a persistence layer or anonymising data taken from a production service.independent, abapFake data generator for ABAPfrom ABAP
- cap-mock-generatorcap-mock-generatorParses 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.independent, capFills db/data with relationally consistent CSV from a .cds schemafrom CAP
Details
Sources
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
History in the atlas
- Verdict rings retired. What the ring compressed now lives in readings derived from facts (liveness, compatibility, reach) and in the description fields, so a thing can be dead as a dependency and still worth reading. VISION §9.
- Placement put it on testing because the README says 'for testing'. Reading what it does moved it: cds add mockdata writes CSV into db/data, which is the seed-data capability — and precisely where that capability already said the core stops. It seeds a database; it does not build fixtures in a test.
- Narrower than it was: the core has generated seed volumes with `cds add data` since mid-2024, so what is left here is per-element realism via Faker annotations. Still the only thing offering that. Dormant two years matters less for a build-time generator whose output is CSV you keep — the real caution is the peer range, which predates cds 9.
- First seen.
For your agent
- Ref
artifact:mauriciolauffer-cap-js-mockdata- JSON
- /artifacts/mauriciolauffer-cap-js-mockdata.json
- MCP
- Connecting an agent