-
Notifications
You must be signed in to change notification settings - Fork 13
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
Not working on unsupported types (sqlite) #17
Comments
Interesting. Thanks for the issue. Not sure what Prisma will report in the
If you find a fix for it, even better 😅 Otherwise I'll investigate with the help of the failing test. |
I'm very limited on time right now but I think changing this: if (['String'].includes(field.type)) {
return `${field.name}: '${field.default}'`;
} to this: if (['String'].includes(field.type)) {
const docLines = field.documentation?.split('\n') || [];
const fake = docLines.find((line) => line.startsWith('FAKE:'));
if (fake) {
const fakeValue = fake.replace('FAKE:', '');
if (!fakeValue) {
logger.warn(
`Incorrect format for fake JSON. Field ${field.name} won't be generated. Example: ///[FAKE:{"test": "faker.lorem.word()"}]`,
);
return null;
}
return `${field.name}: ${fakeValue}`;
}
return `${field.name}: '${field.default}'`;
} should do it. |
Basically keeps the current implementation unless there is a |
In case of
sqlite
the generator won't create faker objects despite the annotations because it's listed as string.But there are extensions for sqlite that would allow this also there could be manual serialization.
Would be great if that's supported.
The text was updated successfully, but these errors were encountered: