Skip to content
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

$select should support /$count and ($count=true) for collection-valued structural properties #2046

Open
mikepizzo opened this issue Feb 5, 2025 · 6 comments · May be fixed by oasis-tcs/odata-abnf#123 or #2050
Assignees

Comments

@mikepizzo
Copy link
Contributor

No description provided.

@mikepizzo mikepizzo converted this from a draft issue Feb 5, 2025
@mikepizzo
Copy link
Contributor Author

mikepizzo commented Feb 5, 2025

We currently support $expand=navProp/$count to return just the count of the nav prop.
We also support $expand=navProp($count=true) to return the nav prop and the count.
We support $select=prop($count=true).
We support prop/$count in a filter ($filter=collectionProp/$count gt 5)
We don't seem to support $select=prop/$count or $select=prop/$count(...)

It seems like we should.

@mikepizzo
Copy link
Contributor Author

Proposal: Support the same /$count functionality for $select as we support for $expand.

collectionProp/$count
collectionProp/$count($filter....)

@mikepizzo
Copy link
Contributor Author

Resolved as proposed 2025-2-5

@mikepizzo mikepizzo self-assigned this Feb 5, 2025
@mikepizzo mikepizzo moved this from Open to Resolved in OData TC Feb 5, 2025
@mikepizzo mikepizzo changed the title Should ABNF support /$count in $Select $select should support /$count and ($count=true) for collection-valued structural properties Feb 6, 2025
@xuzhg
Copy link

xuzhg commented Feb 9, 2025

If the type contains a lot of properties, Is there any simple way to get all properties but for a certain collection properties, only get the number, so, we don't want to list all other properties within $select.

For example, can we do like:

$select=*,ColProp/$count

@mikepizzo
Copy link
Contributor Author

I believe the above would return all properties (including ColProp) plus the count of ColProp.

In general, we don't have a way to except individual properties in the select (or expand) list. We could introduce something like -propName, so you could do $select=*,-ColProp, ColProp/$count.

@mikepizzo mikepizzo linked a pull request Feb 12, 2025 that will close this issue
@mikepizzo
Copy link
Contributor Author

2025-2-12: We discussed omitting the counted properties. If we want to omit the counted property, we should do it through a generic method that omits properties. Such a mechanism should be handled separate from this issue.

There did not seem to be an expressed need in pursuing such a mechanism at this time.

@mikepizzo mikepizzo linked a pull request Feb 19, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Resolved
Development

Successfully merging a pull request may close this issue.

2 participants