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

Filters on 'complex' attribute arrays don't seem to work #55

Open
DillonSadofsky opened this issue Oct 4, 2024 · 0 comments
Open

Filters on 'complex' attribute arrays don't seem to work #55

DillonSadofsky opened this issue Oct 4, 2024 · 0 comments

Comments

@DillonSadofsky
Copy link

I have built my integration using scimmy and it mostly seems to be working. However, I pulled down the example PostMan tests mentioned here scimmyjs/scimmy-routers#10 (comment)

I brought in parse/filter from scim2-parse-filter for applying filters, but the attribute filtering seems to be automatic/built in.

The issue is that there is a test that hits /Users?attributes=emails[type eq "work"]. The core problem is that even though I have data that should match this attribute filter, it doesn't seem to work correctly. For example, you can see if I limit myself to ids I created to test, I have rows that do have an email sub-object of type "work":
image

However, if I add back in the filter on type eq "work", it finds no emails:
image

Which I think is wrong

I put some breakpoints in this library and I ended up tracing down into #filter in scimmy/dist/lib/types.js and it seemed like the issue was that it would see that it was an array filter on a complex attribute, so it'd recurse onto the user.emails, then recurse to user.emails[0], but the inclusions object is empty because this if on line 1755 doesn't pass:

for (let key in {...filterable}) if (Array.isArray(filterable[key]) && filterable[key][0] === "pr") { 

so the emails.type gets ignored, so its an empty object with no inclusions, so my emails[0] doesn't pass the filter type eq "work", which when I bubble up to the part where its filtering the array, we see v is empty now, so it gets thrown out:

image

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

No branches or pull requests

1 participant