codebeast
02/20/2019, 8:30 AMLineItemCreateManyWithoutInvoiceInput
Jenkins
02/20/2019, 8:32 AMcodebeast
02/20/2019, 8:33 AMcodebeast
02/20/2019, 8:33 AMJenkins
02/20/2019, 8:35 AMcodebeast
02/20/2019, 8:38 AMJenkins
02/20/2019, 8:43 AMLineItemCreateManyWithoutInvoiceInput
.
type Invoice @model {
id: ID! @unique
lineItems: [LineItem!]! @relation(name: "InvoiceItems")
}
type LineItem @model {
id: ID! @unique
invoice: Invoice! @relation(name: "InvoiceItems")
}
on line nr. 189 in the generated schema.graphql
.codebeast
02/20/2019, 9:00 AMJenkins
02/20/2019, 9:02 AMgenerate:
in prisma.yml
, add:
- generator: graphql-schema
output: ./path/to/generated
Jenkins
02/20/2019, 10:23 AM.
? 😛Jenkins
02/20/2019, 10:24 AMcodebeast
02/20/2019, 10:27 AM- generator: typescript-client
output: ./generated/prisma-client/
codebeast
02/20/2019, 10:27 AMtypescript-client
not graphql-schema
codebeast
02/20/2019, 10:32 AMLineItemCreateManyWithoutInvoiceInput
is generated incodebeast
02/20/2019, 10:36 AM# import LineItemCreateManyWithoutInvoiceInput from "generated/prisma-client/prisma-schema.ts"
`
I got this error: Syntax Error: Unexpected Name "generated"
codebeast
02/20/2019, 10:44 AMJenkins
02/20/2019, 10:46 AM# import x from "schema.graphql"
.Jenkins
02/20/2019, 10:47 AMJenkins
02/20/2019, 10:52 AMcodebeast
02/20/2019, 10:55 AMcodebeast
02/20/2019, 10:55 AMJenkins
02/20/2019, 11:00 AMdatamodel.prisma
.
Then, for either GraphQL-Yoga(which I'm guessing you're using) or ApolloServer, you need a schema.graphql
. If you wanted to just directly expose your API to the world you could use said file in the typeDefs
of the constructor. But most likely, especially with mutations, you want to hide certain parts. So that's when you create your own schema.graphql that you use with your server. To make it easy to reuse your models (Product, User, etc...) you can import them directly to your custom one from the generated. That way they're always in sync between your datamodel.prisma
, ./generated/schema.graphql
and ./schema/my_custom_schema.graphql
. Makes sense? 🙂codebeast
02/20/2019, 11:03 AMJenkins
02/20/2019, 11:04 AM