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

$top option doesn't work #62

Open
williamhCode opened this issue Mar 11, 2024 · 2 comments · Fixed by #65
Open

$top option doesn't work #62

williamhCode opened this issue Mar 11, 2024 · 2 comments · Fixed by #65

Comments

@williamhCode
Copy link
Contributor

Hello, I'm a Purdue student using the api for my CS 307 software engineering project. I'm trying to implement a searching function for all courses, but I noticed that purdue api doesn't support the $top query option. The problem is if there's too many results it takes a while to load, which stalls the searching. It would be a lot more efficient to use $top and $skip so I can lazy load the results when scrolling down. Is it trivial to implement $top? If you don't have time and it's relatively simple I was thinking I could make a pull request.

Result of this query Courses?$top=10:

{
    "error": {
        "code": "",
        "message": "The query specified in the URI is not valid. The limit of '0' for Top query has been exceeded. The value from the incoming request is '10'.",
        "details": [],
        "innererror": {
            "message": "The limit of '0' for Top query has been exceeded. The value from the incoming request is '10'.",
            "type": "Microsoft.OData.ODataException",
            "stacktrace": "   at Microsoft.AspNetCore.OData.Query.Validator.TopQueryValidator.Validate(TopQueryOption topQueryOption, ODataValidationSettings validationSettings)\n   at Microsoft.AspNetCore.OData.Query.Validator.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\n   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\n   at Microsoft.AspNetCore.OData.Query.EnableQueryAttribute.OnActionExecuting(ActionExecutingContext actionExecutingContext)"
        }
    }
}
@haydenmc
Copy link
Member

Hello! Thank you for the report! I'll take a look when I get a chance, but pull requests are always welcome. 😊

haydenmc pushed a commit that referenced this issue Mar 23, 2024
Fixes #62
Tested that using $top > 0 works now
I'm assuming `.Page()` should've been uncommented after the issue was
fixed in .NET 6?
@haydenmc
Copy link
Member

I recently had to revert the change that resolved this issue due to a performance regression. Apologies! See #67 for more details.

@haydenmc haydenmc reopened this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants