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

Saule cannot filter more than one input parameter. #112

Open
dhirajdhakal09 opened this issue Jun 2, 2016 · 13 comments
Open

Saule cannot filter more than one input parameter. #112

dhirajdhakal09 opened this issue Jun 2, 2016 · 13 comments

Comments

@dhirajdhakal09
Copy link

Hi,

I tried to filter out with two input parameters with comma separated as defined by jsonapi.org but it always returns null.

http://example.com/articles/filter[something]=1234 works

http://example.com/articles/filter[something]=1245,1235 won't work.

is this feature missing?

Thanks

@joukevandermaas
Copy link
Owner

I think it's probably not supported yet, but you might be able to get it working using custom filter expressions. See here for more info.

I assume the value you'd get is the string including the comma.

@dhirajdhakal09
Copy link
Author

Hi Jouke,

Has this already in place?

Please let me know.

Thanks!!

On Thu, Jun 2, 2016 at 1:20 PM, Jouke van der Maas <notifications@github.com

wrote:

I think it's probably not supported yet, but you might be able to get it
working using custom filter expressions. See here
https://github.com/joukevandermaas/saule/wiki/Queryable-endpoints#customizing-filtering-expressions
for more info.

I assume the value you'd get is the string including the comma.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#112 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ASxFnXQ_eR_WMYxwKD0H1yxorvewtBW0ks5qHoe4gaJpZM4IsHjH
.

@joukevandermaas
Copy link
Owner

It isn't. I'm open to a PR but I don't have time to pick this up ATM.

@PhyberApex
Copy link
Contributor

If I wanted to pick this up what would be a good solution to escape a ","?

~Cheers

@joukevandermaas
Copy link
Owner

@PhyberApex I don't think we need to support escaping commas to be honest. If the spec doesn't mention it, it shouldn't be blocking us IMO.

@PhyberApex
Copy link
Contributor

PhyberApex commented Oct 5, 2018

Okay sure. This is going to be a problem for string fields tho for sure. In one of our use cases that would be a deal breaker tbh. We use the filter on a name field to validate for free names. We check if the response is empty. If so the name is free and we can validate it as okay. "," is not a disallowed character in our names. This implementation would actually break our current usage and potentially others. I am not sure that should be done tbh. Is there any mention on filters at all in the spec? iirc it only mentions filters and that what they do is up to you.

~Cheers

@joukevandermaas
Copy link
Owner

I suppose we could do like in CSV? So if the filter string is in quotes, we don't interpret the commas?

?filter[prop]="some,value" => checks that prop is "some,value".
?filter[prop]=some,value => checks that prop is some or value.

@PhyberApex
Copy link
Contributor

Just so I understand you correctly. This would mean I could not do a "or" filter on multiple strings containing "," is this correct?

~Cheers

@joukevandermaas
Copy link
Owner

It would be like ?filter[prop]="a,b","b,c", I think.

@PhyberApex
Copy link
Contributor

Okay I will probably take a look at this during this weekend. And open an PR when I'm ready.

~Cheers

@PhyberApex
Copy link
Contributor

I have this working now with strings. I can't quite figure out how to do it with enums or ints yet.
Should I open the PR? Maybe you can give some insight on this. I think I am not proficient enough with LINQ to really get this done.

~Cheers

@joukevandermaas
Copy link
Owner

@PhyberApex a PR with the first steps would be great, thanks! If I remember right, the filtering code is pretty complex.

@PhyberApex
Copy link
Contributor

Done!

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

3 participants