PHPLIB-1598 Use named types for enums#1570
Conversation
| int $buckets, | ||
| Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, | ||
| Optional|Document|Serializable|stdClass|array $granularity = Optional::Undefined, | ||
| Optional|string $granularity = Optional::Undefined, |
There was a problem hiding this comment.
The type was incorrect. granularity must be a string: https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/
jmikola
left a comment
There was a problem hiding this comment.
IIRC, in a previous Atlas Search PR you opted not to use enums since that might become a hindrance if something changed upstream before this library was able to apply the change.
In the event the server removed a supported string value, might that lead of a situation in the library where we'd be stuck with it out of BC obligations?
Certainly not for this implementation, since everything is just a string; however, I'm concerned with what happens if you do start modeling the server API more closely. I'm very sensitive to how that might backfire on us (similar to #1569).
| 'Window' => [ | ||
| 'acceptedTypes' => [...$bsonTypes['object']], | ||
| ], | ||
| 'GeoPoint' => [ |
There was a problem hiding this comment.
Just want to confirm that "FillOut", "Window", and "GeoPoint" were never used.
There was a problem hiding this comment.
If they were used, the generator would fail.
Fix PHPLIB-1598
When a field accepts a specific list of values, I use a named type. It will be possible to improve the parameter types later by specifying the list of accepted values.