edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

Type unions in link targets break query builder

Open fmoor opened this issue 3 years ago • 0 comments

edgedb-js version: ^0.19.8 edgedb server: 1.1 edgedb cli: EdgeDB CLI 1.1.0-dev.742+9b148e5

# dbschema/default.esdl
module default {
  type A {}
  type B {}

  type C {
    multi link a_or_b -> A | B;
  }
}
$ yarn edgeql-js --target ts --force-overwrite
yarn run v1.22.11
$ /tmp/edb-js/node_modules/.bin/edgeql-js --target ts --force-overwrite
Generating query builder into ./dbschema/edgeql-js
Connecting to EdgeDB instance...
Introspecting database schema...
/tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:455
            throw new Error(`Cannot find ref: ${identRef.name}`);
                  ^

Error: Cannot find ref: default::(default:A | default:B)
    at CodeBuilder.resolveIdentRef (/tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:455:19)
    at /tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:488:32
    at Array.map (<anonymous>)
    at /tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:486:26
    at Array.map (<anonymous>)
    at CodeBuilder.render (/tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:477:18)
    at DirBuilder.write (/tmp/edb-js/node_modules/edgedb/dist/reflection/builders.js:596:73)
    at async generateQB (/tmp/edb-js/node_modules/edgedb/dist/reflection/generate.js:208:5)
    at async run (/tmp/edb-js/node_modules/edgedb/dist/reflection/cli.js:206:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

fmoor avatar Feb 28 '22 22:02 fmoor