CK-Yong / gaip-net

Library for implementing Google Api Improvement Proposals in C#
MIT License
2 stars 1 forks source link

Review and improve functionality of the HAS operator. #13

Open CK-Yong opened 2 years ago

CK-Yong commented 2 years ago

According to AIP-160:

Has Operator

Filtering implementations must provide the : operator, which means "has". It is usable with collections (repeated fields or maps) as well as messages, and behaves slightly differently in each case.

Repeated fields query to see if the repeated structure contains a matching element:

Example | Meaning -- | -- r:42 | True if r contains 42. r.foo:42 | True if r contains an element e such that e.foo = 42.

There are two slight distinctions when parsing messages:

  • When traversing messages, a field is only considered to be present if it has a non-default value.
  • When traversing messages, field names are snake case, although implementations may choose to support automatic conversion between camel case and snake case.

At the moment this operation is a bit shoddily implemented in the MongoFilterAdapter. More unit tests should be added for this case, and make sure it works as described above, or improved.

CK-Yong commented 2 years ago

Linq adapter is already covered. Should just fix the Mongo one.