-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Builder
-
None
-
None
-
PHP Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Some MQL operators take object-typed arguments (for example $rankFusion, $scoreFusion). Today the builder exposes these as plain array|stdClass, so there is no autocompletion, no static typing, and no validation of the sub-fields at the API level.
Goals:
- Generate a dedicated typed class per such argument, so users of the builder API get proper typing and IDE support for these structures instead of untyped arrays.
- Consider dropping support for stdClass as this is expected to have low usage.
The MQL specifications already support describing this structure (recursive arguments key on object-typed arguments, see mongodb/mql-specifications#33, merged). The generator needs to consume it to produce the typed classes.
A prior attempt exists in mongodb/mongo-php-library#1886 (closed, not merged) and can be used as a reference, but needs rework: rebase on v2.x and address the Psalm findings rather than adding them to the baseline.