Skip to content

Conversation

kylelai1
Copy link
Collaborator

@kylelai1 kylelai1 commented Oct 6, 2025

Description

CLOUDP-348131

  • Adds the mongo type to faker method mapping for the schema editor dropdowns.
  • Drive-by fix for schema display for dark mode compatibility.

Checklist

  • [ x ] New tests and/or benchmarks are included
  • [ N/A ] Documentation is changed or added
  • [ x ] If this change updates the UI, screenshots/videos are added and a design review is requested
  • [ N/A ] I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • [ x ] New feature
  • Dependency update
  • Misc

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • [ x ] Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)
Screen.Recording.2025-10-06.at.11.26.02.AM.mov
Screenshot 2025-10-06 at 11 19 50 AM Screenshot 2025-10-06 at 11 25 10 AM

@kylelai1 kylelai1 marked this pull request as ready for review October 7, 2025 14:23
@kylelai1 kylelai1 requested a review from a team as a code owner October 7, 2025 14:23
Copy link
Contributor

@Copilot Copilot AI left a 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 implements a mongo type to faker method mapping system for schema editor dropdowns, enabling users to select appropriate faker methods based on MongoDB field types.

  • Adds a comprehensive mapping of MongoDB types to corresponding Faker.js methods
  • Implements dynamic dropdown population based on selected MongoDB type
  • Includes dark mode compatibility fixes for schema display

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/compass-generative-ai/src/index.ts Exports MongoDBFieldTypeValues enum for external use
packages/compass-generative-ai/src/atlas-ai-service.ts Makes MongoDBFieldTypeValues enum public by removing internal comment
packages/compass-collection/src/components/mock-data-generator-modal/raw-schema-confirmation-screen.tsx Adds dark mode support for document container styling
packages/compass-collection/src/components/mock-data-generator-modal/faker-schema-editor-screen.tsx Implements automatic faker method selection when MongoDB type changes
packages/compass-collection/src/components/mock-data-generator-modal/faker-mapping-selector.tsx Replaces hardcoded dropdown options with dynamic mapping-based options
packages/compass-collection/src/components/mock-data-generator-modal/faker-mapping-selector.spec.tsx Adds comprehensive test coverage for the new dropdown functionality
packages/compass-collection/src/components/mock-data-generator-modal/constants.ts Defines the mapping of MongoDB types to available Faker methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import FakerMappingSelector from './faker-mapping-selector';
import type { FakerSchema, MockDataGeneratorState } from './types';
import type { MongoDBFieldType } from '@mongodb-js/compass-generative-ai';
import { getDefaultFakerMethod } from './script-generation-utils';
Copy link
Preview

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

The import of getDefaultFakerMethod from ./script-generation-utils is added but this function is not defined or implemented in the visible changes. This will cause a compilation error.

Suggested change
import { getDefaultFakerMethod } from './script-generation-utils';

Copilot uses AI. Check for mistakes.

@kylelai1 kylelai1 changed the title [WIP] feat: CLOUDP-348131: Schema Editor Dropdowns: Add mongo type to faker method mapping feat: CLOUDP-348131: Schema Editor Dropdowns: Add mongo type to faker method mapping Oct 7, 2025
@github-actions github-actions bot added the feat label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant