{"repo":"MrLeebo/prisma-ast","free":true,"listed":false,"github":"https://github.com/MrLeebo/prisma-ast","clone":"git clone https://github.com/MrLeebo/prisma-ast.git","description":"Abstract Syntax Tree for parsing schema.prisma files","language":"TypeScript","stars":167,"topics":["prisma","schema","sdk","ast","abstract-syntax-tree","parser","printer","parse","javascript","typescript"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"@mrleebo/prisma-ast This library uses an abstract syntax tree to parse schema.prisma files into an object in JavaScript. It also allows you to update your Prisma schema files using a Builder object pattern that is fully implemented in TypeScript. It is similar to @prisma/sdk except that it preserves comments and model attributes. It also doesn't attempt to validate the correctness of the schema at all; the focus is instead on the ability to parse the schema into an object, manipulate it using JavaScript, and re-print the schema back to a file without losing information that isn't captured by other parsers. It is probable that a future version of @prisma/sdk will render this library obsolete. Install Examples Produce a modified schema by building upon an existing schema produceSchema is the simplest way to interact with prisma-ast; you input your schema source and a producer function to produce modifications to it, and it will output the schema source with your modifications applied. For more information about what the builder can do, check out the PrismaSchemaBuilder class. PrismaSchemaBuilder The produceSchema() utility will construct a builder for you, but you can also create your own instance, which may be useful for more interactive use-cases. Query the prisma schema for specific objects The builder can also help you find matching objects in the schema based on name (by string or RegExp) or parent context. You can use this to write tests against your schema, or find field","default_branch":null,"files":null,"tree":[],"storefront":"/r/MrLeebo","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/MrLeebo/prisma-ast/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}