-
Notifications
You must be signed in to change notification settings - Fork 245
fix: add relationship fields items and anyOf support COMPASS-9649 #7161
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 support for extracting fields from nested array and mixed type schemas in the data modeling store. The change enables selection of fields that are nested under items (array schemas) and anyOf (mixed type schemas).
- Extends the
extractFieldsfunction to handleanyOfanditemsschema properties - Recursively processes array items and union type schemas to discover nested fields
- Adds comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/compass-data-modeling/src/store/diagram.ts | Adds recursive field extraction for anyOf and items schema properties |
| packages/compass-data-modeling/src/store/diagram.spec.ts | Adds test cases covering flat, nested, array, and mixed type schema field extraction |
| items: { | ||
| bsonType: 'object', | ||
| properties: { | ||
| prop3A: { bsonType: 'string' }, | ||
| }, | ||
| }, |
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.
Do you want to add a case where items is an array? Seems possible based on the implementation
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.
True, let me add it!
Description
This is enabling selection of fields that are nested under an array or a mixed type
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes