prisma / prisma-test-utils

A collection of data model agnostic test utils.
114 stars 11 forks source link

Unknown arg `data` in data #32

Open divyenduz opened 4 years ago

divyenduz commented 4 years ago

On the table described in https://github.com/prisma/prisma2/issues/1793 (a table with only one ID field that is optional). The generate Prisma client create has no way to provide any create data.

test-utils yields the following query and error for such a table:

2020-03-09T10:52:00.955Z printStack callsite undefined
2020-03-09T10:52:00.956Z printStack callsite Error
    at new baseball_defensive_groupClient (/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/index.js:6977:21)
    at Object.baseball_defensive_group.create (/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/index.js:6880:7)
    at /home/runner/work/introspection-engine-output/prisma-test-utils/src/static/seed.ts:924:45
    at Generator.next (<anonymous>)
    at /home/runner/work/introspection-engine-output/prisma-test-utils/dist/static/seed.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/introspection-engine-output/prisma-test-utils/dist/static/seed.js:4:12)
    at iterate (/home/runner/work/introspection-engine-output/prisma-test-utils/dist/static/seed.js:633:24)
    at /home/runner/work/introspection-engine-output/prisma-test-utils/src/static/seed.ts:947:30
    at Generator.next (<anonymous>)
PrismaClientValidationError: 
Invalid `prisma.baseball_defensive_groups.create()` invocation in
/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/index.js:6880:7

{
  data: {}
  ~~~~
}

Unknown arg `data` in data for type baseball_defensive_group. The field createOnebaseball_defensive_group has no arguments.

    at Document.validate (/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/runtime/index.js:1:81256)
    at baseball_defensive_groupClient.get _document [as _document] (/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/index.js:6998:16)
    at baseball_defensive_groupClient.then (/home/runner/work/introspection-engine-output/introspection-engine-output/clients/mysql_public_test_utils/sportsdb/index.js:7024:24)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

There is no workaround for now because on removing the data field from the create, we run into a panic as mentioned on https://github.com/prisma/prisma2/issues/1793

Once that issue is resolved, this can move forward.


Internal notes:

Test utils database(s) affected: