Expected behavior
By default, the reference key of a table should be setup to the table's primary key
Actual behaviour
On my local environment, the reference key of table Beneficiary was empty on the frontend, therefore it was defaulted to the Address field (I guess by alphabetical order).
This field is not a Column but instead is a ManyToOne relationship
Failure Logs
ValidationError: Unexpected field type: 'retailer.address' (found 'ManyToOne' expected 'Column')
at Function.validate (/Users/qhello/src/sline/node_modules/@forestadmin/datasource-toolkit/src/validation/field.ts:19:15)
at Function.validate (/Users/qhello/src/sline/node_modules/@forestadmin/datasource-toolkit/src/validation/field.ts:45:22)
at /Users/qhello/src/sline/node_modules/@forestadmin/datasource-toolkit/src/validation/projection.ts:6:48
at Array.forEach (<anonymous>)
at Function.validate (/Users/qhello/src/sline/node_modules/@forestadmin/datasource-toolkit/src/validation/projection.ts:6:16)
at Function.parseProjection (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/utils/query-string.ts:58:27)
at Function.parseProjectionWithPks (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/utils/query-string.ts:69:5)
at ListRoute.handleList (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/routes/access/list.ts:22:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at ErrorHandling.errorHandler (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/routes/system/error-handling.ts:17:7)
warning: [400] GET /beneficiary - 155ms
===== An exception was raised =====
GET /beneficiary?{
timezone: Europe/Paris,
fields[beneficiary]: createdAt,id,name,retailer,stripeAccountId,updatedAt,
fields[retailer]: address,
page[number]: 1,
page[size]: 15,
sort: -id
}
Invalid projection
Error: Invalid projection
at Function.parseProjection (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/utils/query-string.ts:63:6)
at Function.parseProjectionWithPks (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/utils/query-string.ts:69:5)
at ListRoute.handleList (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/routes/access/list.ts:22:25)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at ErrorHandling.errorHandler (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/routes/system/error-handling.ts:17:7)
at Logger.logger (/Users/qhello/src/sline/node_modules/@forestadmin/agent/src/agent/routes/system/logger.ts:20:7)
at bodyParser (/Users/qhello/src/sline/node_modules/koa-bodyparser/index.js:95:5)
at cors (/Users/qhello/src/sline/node_modules/@koa/cors/index.js:107:16)
===================================
Context

"@forestadmin/agent@npm:beta":
version: 1.0.0-beta.37
"@forestadmin/datasource-sql@npm:beta":
version: 1.0.0-beta.32
Expected behavior
By default, the reference key of a table should be setup to the table's primary key
Actual behaviour
On my local environment, the reference key of table
Beneficiarywas empty on the frontend, therefore it was defaulted to theAddressfield (I guess by alphabetical order).This field is not a
Columnbut instead is aManyToOnerelationshipFailure Logs
Context