New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefixing an entity with Prisma field type leads to an incorrect schema #2019
Comments
Thanks for reporting @sohelzerdoumi. This is a significant bug. Nice work! |
Oh wow! This is a bug in our PSL parser -> I probably forgot to check for "end of word" when matching those keywords. Shouldn't be too hard to fix, a bit of parsec magic and we should be good! |
@Martinsos The "end of word" rule possibly wouldn't solve it. Not sure how Prisma handles this, but if PSL has different namespaces for type space and value space like most languages do, we'd need something more elaborate. For example, if Prisma allows entities to be named |
INteresting point, but I doubt it, how would it differentiate between their Int and custom Int then? PSL is quite simple, so position is important, and at that position it always expects a type space name, not value space name. So I don't think this is an issue, it indeed should only be just "end of word". I am 98% confident in this. |
This will be fixed by this commit 1b1753a#diff-55352e979a392d702b404e0a168abbf61a0c26527248deee8ea77055287e9626R85 Background: there is a
|
When generating Prisma schema from Wasp entities, the reserved words for field type, collide with entity name. This results in incorrect Prisma schema output.
The following reserved words lead to incorrect replacement:
String
,Boolean
,Int
,BigInt
,Float
,Decimal
,DateTime
,Json
, andBytes
Example:
The following Wasp entity definition uses the reserved word
Int
as a prefix for an entity nameInternet
:The generated Prisma schema output is incorrect:
The expected output should be:
Steps to reproduce:
Int
) for an entity name.Expected behavior: The reserved word prefix should be replaced with a valid entity name.
Probable issue location
wasp/waspc/src/Wasp/AppSpec/Entity/Field.hs
Line 64 in 7658064
The text was updated successfully, but these errors were encountered: