Skip to content
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

Allow overriding faker method using prisma comment #20

Merged

Conversation

brynedwards
Copy link
Contributor

Implements #12

@@ -12,6 +12,10 @@ function getFieldDefinition(
const fakeLine = docLines.find((line) => line.startsWith('FAKE:'));
const fakeValue = fakeLine?.replace('FAKE:', '');

if (fakeValue) {
Copy link
Owner

@luisrudge luisrudge Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should remove the code related to JSON now that we support a simpler approach that is valid for all fields.. what are your thoughts on this?
https://github.com/luisrudge/prisma-generator-fake-data/pull/20/files#diff-9f2dd6068c2dc5460ec9d76b011ed01f9148e427b807ddb5b96d03f259253f97R140-R154

seems like this code will never run with this change, so we might as well remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should remove the code related to JSON now that we support a simpler approach that is valid for all fields.. what are your thoughts on this? https://github.com/luisrudge/prisma-generator-fake-data/pull/20/files#diff-9f2dd6068c2dc5460ec9d76b011ed01f9148e427b807ddb5b96d03f259253f97R140-R154

seems like this code will never run with this change, so we might as well remove it.

I left it because I saw the logger.warn() call but now I see that it only triggers if the comment is "empty" i.e. just ///FAKE:. I removed the code and added a similar check to the top and changed the wording. Also, maybe I'm doing something wrong, but I can't get logger.warn() to print anything when running prisma generate, I only see log messages when running the tests.

@luisrudge luisrudge merged commit df30449 into luisrudge:main Jan 25, 2024
1 check passed
@luisrudge
Copy link
Owner

released in https://github.com/luisrudge/prisma-generator-fake-data/releases/tag/v0.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants