-
Notifications
You must be signed in to change notification settings - Fork 8
feat(autocomplete): add type generator from the php yaml definitions MONGOSH-2030 #521
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
… have a schema defined
lerouxb
reviewed
May 28, 2025
addaleax
reviewed
Jun 5, 2025
lerouxb
reviewed
Jun 9, 2025
addaleax
reviewed
Jun 10, 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.
Amazing work @nirinchev! ✨
lerouxb
reviewed
Jun 10, 2025
lerouxb
approved these changes
Jun 10, 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.
Great work! Like I explained I think we probably don't need 7fc9890 anymore. Up to you if you want to remove it again.
lerouxb
reviewed
Jun 10, 2025
addaleax
approved these changes
Jun 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds generators for the aggregation stages using the yaml definitions from https://github.com/mongodb-js/mongo-php-library/tree/v1.x/generator/config.
Three generators are added to process the yaml definitions:
schema-generator.ts
generates a typescript schema from the yaml definitions which can be used to autocomplete aggregation stages. Notable limitations of the current schema include:$unset: [ 'foo.bar' ]
$addFields
,$project
, etc. will not reflect the new collection schema$lookup.let
)SearchScore
,GeoPoint
, etc.)driver-schema-generator.ts
generates the schema for the tests in the php yaml library. It does this by infering the schema from the documentation.test-generator.ts
generates tests from the yaml definitions. Those are not functional tests, but rather verify that the code compiles - that is, the schema definition does not generate false negatives. They don't attempt to verify that the autocompletion always suggests precise results though - i.e. a schema definition where everything isany
would pass all the tests in this PR. Validating autocomplete results are helpful is a follow-up task that will be done when we integrate all the autocomplete tickets together.Open Questions
We probably want to get mongodb/mongo-php-library#1659 eventually merged to ensure we don't diverge too far from upstream.