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

[feature/netcore] Support "/$count" and "?$count=true" #1153

Closed
smlynch opened this issue Dec 9, 2017 · 16 comments
Closed

[feature/netcore] Support "/$count" and "?$count=true" #1153

smlynch opened this issue Dec 9, 2017 · 16 comments

Comments

@smlynch
Copy link

smlynch commented Dec 9, 2017

It appears neither counting all entities (/SomeEntity/$count) nor adding counts inline (/SomeEntity?$count=true) are supported with the alpha release of Microsoft.AspNetCore.OData

Assemblies affected

Microsoft.AspNetCore.OData.dll, 7.0.0-Nightly201712061320

Reproduce steps

  • go to SomeEntity/$count
  • go to SomeEntity?$count=true

Expected result

  • number response
  • @odata.count added as metadata to response

Actual result

  • returns 404
  • does not include @odata.count
@robward-ms
Copy link
Contributor

Fixed by #1152

@techniq
Copy link

techniq commented Dec 12, 2017

I was just trying to pull this down and build, but currently getting the following error (project built fine before this change).

image

I'm using Visual Studio for Mac with .NET Core 2.0. It could still be on my side.

@techniq
Copy link

techniq commented Dec 12, 2017

actually getting a few errors during a build:

image

@techniq
Copy link

techniq commented Dec 12, 2017

Sorry, disregard. I had to force VS to refresh the solution to see the changes.

@techniq
Copy link

techniq commented Dec 12, 2017

@robward-ms Sorry for all the noise, but I just checked, and while inline counts (?$count=true) are now working, /$count is still returning a 406 (not acceptable). Is there possibly something else I need to add to Startup to enable this endpoint?

@robward-ms robward-ms reopened this Dec 12, 2017
@robward-ms
Copy link
Contributor

The /$count is likely an issue with formatting, #1157 has the latest formatting code. I'm seeing a good pass rate in the latest code on my working branch (NetCore-Latest). I'll leave the issue open until we can verify it's fixed.

@techniq
Copy link

techniq commented Dec 12, 2017

@robward-ms Thanks. I've been collecting a list of items I've found that currently do not work. Should I log them as individual issues, or create 1 issue with a bulleted/checklist? Some are fairly specific (ex. nested $expands) and some might become fixed on your latest changes.

Unrelated, but I just logged this (OData/lab#79) that you might have some feedback on.

Thanks for all your hard work.

@robward-ms
Copy link
Contributor

@techniq - Yes, please do files issues. I think an issue per bug is cleaner but if they are related, i.e. $expand problems, feel free to lump those together.

@techniq
Copy link

techniq commented Dec 12, 2017

@robward-ms Sounds good. I'll look to pull down your NetCore-Latest and test there before submitting new issues (that might already been resolved by unmerged PRs). Is that branch your "develop" branch that you keep in sync with your pending PRs?

@robward-ms
Copy link
Contributor

@techniq - Yes, NetCore-Latest is where I keep the latest dev code. At this point, they are really close product code-wise (NetCore-Latest has unit tests though). The main difference now is the formatter PR #1157. They will converge in the next week or so.

@techniq
Copy link

techniq commented Dec 12, 2017

@robward-ms I just pulled down your NetCore-Latest branch and /$count was working. I'll leave this issue open until I see #1157 resolved (feel free to make this issue as resolved via that PR if you want as well)

@robward-ms robward-ms removed the fixed label Dec 12, 2017
@techniq
Copy link

techniq commented Dec 18, 2017

This is fixed and can be closed (using 7.0.0-Nightly201712181325). I don't seem to have the ability to close this myself now.

@robward-ms
Copy link
Contributor

@techniq - Thanks for the feedback!

@engenb
Copy link

engenb commented Sep 17, 2019

I think this needs to be reopened. I am encountering this issue with Microsoft.AspNetCore.Odata 7.2.1 / Microsoft.AspNetCore.OData.Versioning.ApiExplorer 3.2.3

/resource$count=true works
/resource/$count does not work (404)

@Echarnus
Copy link

I think this needs to be reopened. I am encountering this issue with Microsoft.AspNetCore.Odata 7.2.1 / Microsoft.AspNetCore.OData.Versioning.ApiExplorer 3.2.3

/resource$count=true works
/resource/$count does not work (404)

Can confirm. Having the same issue over here.

@EnthusedDragon
Copy link

I'm also having the same issue with OData V7.2.1 and V7.2.2, Versioning V3.2.4, and ApiExplorer V3.2.3.

All $select, $filter, $top, $skip, etc works fine.

But using $count doesn't return the count value alongside the result array.

endpoint: "templates/v1?$count=true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants