Skip to content

@@validate attribute, looking only one level deep into abstract models #971

Closed
@AlekseiAQ

Description

@AlekseiAQ

Description and expected behavior
@@Validate attribute, looking only one level deep into abstract models. It should be looking into all the models.
Example:

abstract model Level1 {
    id String @id @default(cuid())
    URL String?
    @@validate(URL != null, "URL must be provided") // works
}
abstract model Level2 extends Level1 {
    @@validate(URL != null, "URL must be provided") // works 
}
abstract model Level3 extends Level2 {
    @@validate(URL != null, "URL must be provided") // doesn't work
}

Error message at Level3 model:

Could not resolve reference to ReferenceTarget named 'URL'.zmodel(linking-error)
expression cannot be resolvedzmodel

Screenshots
n/a

Environment (please complete the following information):

  • ZenStack version: "zenstack": "1.7.1"
  • Prisma version: "prisma": "^5.8.1"
  • Database type: Planetscale mysql

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions