-
Notifications
You must be signed in to change notification settings - Fork 246
feat(compass-collection): Add descriptions to FakerJS methods - CLOUDP-358516 #7561
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds helpful descriptions to FakerJS methods in the mock data generator to improve user understanding of less obvious method behaviors. The changes transform the faker method mappings from simple string arrays to structured objects containing both the method name and an optional description.
Key Changes:
- Updated
MONGO_TYPE_TO_FAKER_METHODSto use objects withmethodand optionaldescriptionfields instead of plain strings - Modified component logic to handle the new object structure when rendering faker method options
- Updated test cases to access the
methodproperty from the new object structure
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| constants.ts | Transforms faker method mappings from string arrays to objects with method names and descriptions |
| faker-mapping-selector.tsx | Updates component to extract method names from objects and pass descriptions to Option components |
| faker-mapping-selector.spec.tsx | Updates tests to access the method property from the new object structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { method: 'number.binary', description: 'Binary number string' }, | ||
| { method: 'number.octal', description: 'Octal number string' }, | ||
| { method: 'number.hex', description: 'Hexadecimal number string' }, |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The descriptions for binary, octal, and hex methods are misleading. These methods return numeric values, not strings. The descriptions should be updated to 'Binary number', 'Octal number', and 'Hexadecimal number' respectively to accurately reflect the return type, or clarified as 'Number in binary format' if they return formatted strings.
| { method: 'number.binary', description: 'Binary number string' }, | |
| { method: 'number.octal', description: 'Octal number string' }, | |
| { method: 'number.hex', description: 'Hexadecimal number string' }, | |
| { method: 'number.binary', description: 'Binary number' }, | |
| { method: 'number.octal', description: 'Octal number' }, | |
| { method: 'number.hex', description: 'Hexadecimal number' }, |
| { method: 'number.octal', description: 'Octal number string' }, | ||
| { method: 'number.hex', description: 'Hexadecimal number string' }, | ||
| { method: 'commerce.price', description: 'Monetary price with decimals' }, | ||
| { method: 'date.weekday', description: 'Day of the week' }, |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description 'Day of the week' is ambiguous as the method is listed under 'Number' type but the description doesn't clarify the format. Consider specifying whether this returns a numeric index (0-6) or the name of the day to match the expected Number type.
| { method: 'date.weekday', description: 'Day of the week' }, | |
| { method: 'date.weekday', description: 'Numeric index of day of the week (0=Sunday, 6=Saturday)' }, |
| Code: [ | ||
| { | ||
| method: 'lorem.sentence', | ||
| description: 'Short line of code', |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description 'Short line of code' is inaccurate for lorem.sentence, which generates Lorem Ipsum text, not actual code. Consider 'Short sentence as code placeholder' or similar to clarify that it's placeholder text being used in a code context.
| description: 'Short line of code', | |
| description: 'Short sentence as code placeholder', |
|
Are the faker method descriptions compiled by us or retrieved from fakerjs? |
@kylelai1 a collaboration between ChatGPT and us 😄. Put it together and then Jacob and Betsy signed off on it after making some changes |
|
Ah ok, I see copilot left some comments about the descriptions. PR looks good if those have been looked over. |
kylelai1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
Description
Checklist
Motivation and Context
Types of changes