@anolilab/prisma-schema-reader

Daniel Bannert's open source work is supported by the community on GitHub Sponsors

Usage no npm install needed!

<script type="module">
  import anolilabPrismaSchemaReader from 'https://cdn.skypack.dev/@anolilab/prisma-schema-reader';
</script>

README

A prisma schema reader and object transformation


Daniel Bannert's open source work is supported by the community on GitHub Sponsors


Installation

Use npm or yarn to install

    npm install @anolilab/prisma-schema-reader --save

Or

    yarn add @anolilab/prisma-schema-reader

Usage

Basic usage

import { SchemaToObjectTransformer } from "@anolilab/prisma-schema-reader";

const prismaSchemaPath = "path to your prisma.schema";

const transformer = new SchemaToObjectTransformer(prismaSchemaPath);

transformer.transform();

The transformer will return a JSON object based on the prisma schema.

{
  "enums": [
    {
      "fields": [
        "ADMIN",
        "USER",
      ],
      "name": "Role",
    },
    ...
  ],
  "models": [
    {
      "documentation": "",
      "fields": [
        {
          "documentation": "",
          "isId": true,
          "kind": "scalar",
          "list": false,
          "map": undefined,
          "name": "id",
          "relationField": false,
          "required": true,
          "type": "Int",
          "unique": false,
        },
      ]
    },
    ...
  ],
}

Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.

Supported Node.js Versions

Libraries in this ecosystem make a best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The anolilab zod-prisma is open-sourced software licensed under the MIT license