Skip to content

ozgurkadir/vscode-cds-csv-generator

Repository files navigation

CDS CSV Generator is a tool to create initial CSV data files for SAP Cloud Application Programming Model applications.

The purpose is just to speed up the development 🚀

Available on Visual Studio Marketplace and Open VSX

Extension Settings & Customization

This extension has two custom setting which are accessible from Settings editor.

1️⃣ Common Entities -> If checked, CSV files for aspect sap.common.CodeList will be produced. Values for entities Countries, Currencies and Languages are retrieved from SAP-samples/cloud-cap-samples.

2️⃣ Number of Rows -> Used to customize the number of rows to be created, default value is 10.


How It Works

Reads the Schema Notation (CSN) file and parses the entities, fields and types that decleared inside the schema.cds file. Afterwards, generates csv files filled with mock or random data for each entity.

Random strings come from mock-data/mockStrings.json file.

ATTENTION: This early preview version does not support all data types and features of Definition Language (CDL) yet.

SWAPI App Demo

INFO: The sample app that used in this demo is : https://github.com/SAP-samples/cloud-cap-hana-swapi. This awesome and quite complex application is really good choice to try this extension.


How to Use

  1. Bring up Command Palette(Ctrl+Shift+P) and type Generate CSV Files ⌨️

  2. Type the namespace of schema.cds file ✍️

  3. Choose csn file from file dialog 📋

  4. Choose a folder to save csv files(db/csv, db/data/ or db/src/csv) 📁

Requirements

To use CAP CSV Generator, csn file should be created by building the app(mbt build or cds build)

Supported Features & Types 🎉

✔️ Compositions and Associations are supported as one-to-one.

✔️ Enums supported with release v0.0.5. The values will be selected from the list of enumeration values.

✔️ cds.UUID

✔️ cds.Timestamp

✔️ cds.DateTime

✔️ cds.Integer

✔️ cds.String

✔️ cds.LargeString

✔️ cds.Boolean

Excluded Features

ATTENTION: Below features are excluded to avoid creating a large number of potentially unnecessary files, entites and elements.

Virtual Elements are excluded.

Abstract Entites are excluded.

Views and Projections are excluded.

sap.common.CodeList entities (Countries, Currencies, Languages) are excluded by default with option to include from Extension Settings

Entities annotated with @cds.persistence.skip are excluded.

Unsupported Features & Limitations

❌ Many-to-many Relationships are not supported yet.

❌ Mock string values are selected from a list of one to three words. In case of exactly one word required(e.g. for a key element), two or three words may appear.

🎉 Enjoy!

About

SAP CAP CDS CSV Generator VS Code Extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published