maoosi / prisma-appsync

⚡ Turns your ◭ Prisma Schema into a fully-featured GraphQL API, tailored for AWS AppSync.

Home Page:https://prisma-appsync.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: When using `is` and `isNot` from `<Model>WhereInput` inside of a `some` or `every`, Prisma throws a validation error.

maoosi opened this issue · comments

commented

The same thing happens with isNull.

At the same time, a query like this will error:

query ListValuations($where: ValuationWhereInput) {
  listValuations(where: $where) {
    agent { 
      uuid
    }
    mandate {
      visits {
        appointment
      }
    }
  }
}
{
  "where": {
    "AND": [
      {
        "agent": {
          "uuid": {
            "equals": "f7607a26-e124-4ece-9b5a-300644d453bb"
          }
        },
        "mandate": {
          "visits": {
            "some": {
              "appointment": {
                "isNull": true
              }
            }
          }
        }
      }
    ]
  }
}

Like so:

{
  "errors": [
    {
      "message": "Invalid query: where,AND,[object Object],agent,uuid,equals,mandate,visits,some,appointment\nInvalid token: [object Object]\nIt must be one of the following:\n - a property name string\n - an array index integer, positive or negative\n - a property name regular expression\n - { type: \"any\" }\n - { type: \"slice\", from: integer, to: integer }",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

It seems to be an error from wild-wild-path's set function, because https://github.com/Tenrys/prisma-appsync/blob/ea7d8adff27ad9776adae8a980e8df48ec257367/packages/client/src/utils.ts#L201 returns the whole array as part of the path instead of the proper index.

@Tenrys Thanks for the details!

I could identify 2 issues: one with the GraphQL schema (for which I have added a new <Model>WhereInputWithoutNullables in the generator template) and one with the path when using arrays like AND or OR.

Could you please give it a try using prisma-appsync@1.0.0-preview.6.8?