zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[BUG] Generated API and openapi spec doesn't handle @@id correctly

Open thomassnielsen opened this issue 1 year ago • 0 comments

When using the openapi plugin (REST variant) with a schema using @@id, the attributes that make up the compound id are not added to the attribute list for the model.

Given the model

model DashboardTiles extends Base {
  clientId Int
  tileType Int
  visible  Boolean
  Client   Client            @relation(fields: [clientId], references: [id])

  @@id([clientId, tileType])
  @@allow("all", check(Client))
}

The expected list of attributes should be

clientId: number
tileType: number
visible: boolean

Currently the list of attributes is only:

visible: boolean
  • ZenStack version: 2.5.1
  • Prisma version: 5.19.1
  • Database type: Postgresql

Discord thread

thomassnielsen avatar Sep 27 '24 09:09 thomassnielsen