Prisma1: Datamodel types without scalar fields break prisma client generation

Created on 9 Nov 2018  Â·  5Comments  Â·  Source: prisma/prisma1

Describe the bug
When creating a data model type without any scalar fields (ie. only relation fields), code generation breaks.

To Reproduce
Steps to reproduce the behavior:

  1. Create a data model type without scalar fields, eg:
type Foobar {
  user: User
}
  1. Run prisma generate
$ yarn prisma generate
yarn run v1.10.1
$ /Users/sp/dev/temp/prisma-bug/node_modules/.bin/prisma generate
Generating schema 49ms
 â–¸    Syntax Error: Expected Name, found }

Get in touch if you need help: https://www.prisma.io/forum/
To get more detailed output, run $ export DEBUG="*"
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior
No error running the generate command.

Versions:

  • prisma CLI: prisma/1.20.1 (darwin-x64) node-v10.10.0

Additional context

Seems like prisma generates an empty input type in this case:

input FoobarUpdateManyMutationInput {

}

and the graphql parser doesn't like that.

bu2-confirmed areclients areclient

Most helpful comment

Had the same issue with 1.20.1. Rolled back to 1.19.3 because of this.
Previous Issues mentioning similar errors:

  • #1981
  • #2123
  • #3382

All 5 comments

Had the same issue with 1.20.1. Rolled back to 1.19.3 because of this.
Previous Issues mentioning similar errors:

  • #1981
  • #2123
  • #3382

I'm having the same issue rolled back to 1.20.0 and it worked

Can confirm what @guatedude2 said, can't generate types without scalar fields with [email protected], works after rolling back to 1.20.0.

This is fixed in 1.20.5. Please let us know if that is not the case and we'll reopen it!

I have same issue with version 1.21.0. I thought that should work after fix in 1.20.5 @timsuchanek

yarn prisma generate with following datamodel works fine:

type FeatureSet implements Node {
  id: ID! @unique
  key: String!
  featureList: [Feature!]!
} 

type Feature implements Node{
  id: ID! @unique
  temp: String!
  featureSetList: [FeatureSet!]!
}

While one where temp attribute is excluded have the same issue as describe above.

type FeatureSet implements Node {
  id: ID! @unique
  key: String!
  featureList: [Feature!]!
} 

type Feature implements Node{
  id: ID! @unique
  featureSetList: [FeatureSet!]!
} 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktani picture marktani  Â·  3Comments

notrab picture notrab  Â·  3Comments

thomaswright picture thomaswright  Â·  3Comments

MitkoTschimev picture MitkoTschimev  Â·  3Comments

schickling picture schickling  Â·  3Comments