Using enum field type results in syntax error when running `prisma deploy`

prisma

#1

Hi all,

I’m trying to define a enum in my datamodel, but it results in syntax error.

Code:

enum MyType {
  "A",
  "B"
}
....

As soon as I run prisma deploy I get this error:

ERROR: Syntax error while parsing GraphQL query. Invalid input "enum MyType {\n  "A",\n  "", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):
enum MyType {
^

{
  "data": {
    "deploy": null
  },
  "errors": [
    {
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "path": [
        "deploy"
      ],
      "code": 3017,
      "message": "Syntax error while parsing GraphQL query. Invalid input \"enum MyType {\\n  \"A\",\\n  \"\", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):\nenum MyType {\n^",
      "requestId": "local:cjrgzupsk000w0810q3idsh6o"
    }
  ],
  "status": 200
}

I’m using prisma 1.25.4. on Mac, Node 11.7. and MySQL 5.7.
Let me know if you need more info about env.

Any idea what could be causing this?


#2

Do not use quotes or commas


#3

Oh wow, that actually did it. Thank you! :slight_smile:

Although, Prisma docs (https://www.prisma.io/docs/datamodel-and-migrations/datamodel-MYSQL-knul/#enum) needs to be updated then because it currently uses commas


#4

, in graphql are optional that is why it works. " are not part of the spec that is why your code was breaking.


#5

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.