2.1.3 • Published 10 months ago
@godspeedsystems/api-generator v2.1.3
godspeed-crud-api-generator
Introduction
A custom prisma generator which will generate godspeed events and workflows for CRUD operations on datasource models. It usages prisma generator API to grab the DMMF of schema on npx prisma generate and based on model definitions it will generate corresponding events and workflows.
Usages
npm install @godspeedsystems/api-generatorin the project directory- Below lines need to be added to the datasource schema file, where auto generation is required
generator godspeed {
provider = "node ../../node_modules/godspeed-crud-api-generator" // relative path to generator package in node_modules
output = "../auto-generated-crud" // basePath for events and functions
}npx prisma generatein the folder, If schema is located at custom path, specify with--schema
Folder structure:
* `events` follow this structure, example: CRUD method of a model `User` in `postgres` datasource
- /[basePath]
- /[datasourceName]
- /[modelName]
- create.yaml (C)
- one.yaml (R)
- update.yaml (U)
- delete.yaml (D)
* `workflows` follow this structure, exapmple: corresponding workflows for above `events`
- /[com.biz]
- /[datasourceName]
- /[modelName]
- create.yaml (C)
- one.yaml (R)
- update.yaml (U)
- delete.yaml (D)Work In Porgress
1. `examples` in `events` schema are WIP
2. Model relations, to represent non scaler fields in OpenAPI schema.This generator was bootstraped using create-prisma-generator