Code-first Prisma schema API
See original GitHub issueAs requested in this issue, we’re currently debating if/how we should provide a code-first API to build up a Prisma schema.
Citing the original arguments (pro code-first) from @HosseinAgha:
- Please re read your article on the problems of schema first development.
- I worry that in time you reach the same conclusion and you end up with a schema language that tries to solve everything but is not as good as a real programming language.
- I think having a real general purpose programming language at your disposal is always a good idea. (take Webpack config or many other tools for example)
- I understand that Prisma is a cross language tool (Go driver for example) but it is also written in JS and Generator and Lift need node to run. So I see no harm in having a
schema.prisma.js
option.
Note that a good foundation for a code-first API might be the Prisma SDK. This issue is used to discuss the possibilities and pros/cons of the approaches.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:45
- Comments:37 (16 by maintainers)
Top Results From Across the Web
GraphQL Nexus: Code-First GraphQL Server Development
The API of Nexus exposes a number of functions that let you define and implement the building blocks for your GraphQL schema, such...
Read more >Nexus for code-first type-safe GraphQL APIs with TypeScript
GraphQL Nexus is a code-first, type-safe GraphQL schema construction library for TypeScript. Learn how the code-first approach with Nexus.
Read more >The Problems of "Schema-First" GraphQL Server Development
Overview: From schema-first to code-first. This article gives an overview of the current state of the GraphQL server development space.
Read more >Prisma schema API (Reference)
Name, Required, Type, Description. provider, Yes, String ( postgresql , mysql , sqlite , sqlserver , mongodb , cockroachdb ), Describes which data...
Read more >Building GraphQL servers with Prisma
It is often used as an alternative to RESTful APIs, but can also be used as an ... Note that a GraphQL schema...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please support a TypeScript, code-first schema!
Benefits of a TypeScript, code-first schema
I don’t like this style of definitions:
It is complex, needs a lot of learning from developer, it’s not really easy readable, etc.
I loved SDL-first approach paired with Prisma and graphql-import: this allowed me to make a toolset that allows to generate resolvers over schema and spin up services with rich CRUD interface in matter of minutes after data definition.
Now with lift, photon and nexus it seems I can’t do this, and this is a big problem for migration of my toolsets to Prisma2
One thing that I think is mandatory is for photon to generate not only programmatic crud-client, but crud schema also, to make it possible to import crud definitions in application schema. This saves A TON of time, seriously