Skip to content

Special-case syntax error for multiple unnamed arguments in directive in the schema parser #2317

@tomhoule

Description

@tomhoule

Problem

The error message when writing @@unique(fieldA, fieldB) instead of @@unique([fieldA, fieldB]) does not guide the user towards the right solution. What we get is:

Unexpected token. Expected one of: alphanumeric identifier.

Solution

Special-case this bad syntax in the schema parser and return an error that guides the user towards the right syntax.

Alternatives

We could make this valid, but this is a much bigger change, since arguments are supposed to be named, except the leftmost one (optionally).

Additional context

Original issue: prisma/migrate#29

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions