-
-
Notifications
You must be signed in to change notification settings - Fork 158
How to pass filter in query params if resource has array attribute property #1370
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
Comments
How is this stored in the database? |
It is being stored as text array in database. |
In that case you can't filter on it. Would cause a full table scan. |
Is there atleast any way to get an array attribute property in the QueryLayer using filter query parameter using JsonApiDotNetCore? |
No, there is not. The JSON:API way is to model as a to-many relationship, which unlocks all existing features. |
A workaround to enable filtering on numbers could be to store and expose as a string field with separators around the numbers and use the |
Is there at least any way to read the filter data of array field attribute Statuses[ ] from the QueryLayer? |
I don't understand your question. QueryLayer contains what's in the request query string. It does not contain the data returned from the database. |
Yes, i want to read the filter query parameter array field attribute Statuses[ ] and need to get the array filter value in the controller from QueryLayer to apply my custom logic as i have created the custom controllers which are inheriting from JsonApiController<TResource, TIdentifier> |
I don't know. What have you tried? |
Closing due to inactivity. |
I am facing the same issue while trying to filter a resource based on a list of integers contained in a field named However, I encountered an error stating that the filter is invalid and that there was a failure to convert '1' from type 'String' to type 'List`1'.
And here is the stack trace for further context: at JsonApiDotNetCore.QueryStrings.FilterQueryStringParameterReader.ReadSingleValue(String parameterName, String parameterValue) and i have also try this filter[groups]=1,2 , filter[groups]='1,2' and facing same issue. Could you please advise on the correct way to pass the filter for a list of integers in the request body using JsonApiDotNetCore? Is there a specific syntax or format that I need to follow to filter on the |
I have a array field attribute in my resource named 'int[ ]? Statuses' which is an array of integer. I want to filter the resource based on 'Statuses' field in resource so how the filter needs to be passed from the request body?
The text was updated successfully, but these errors were encountered: