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

support commas in data_attrs query param #488

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

annashamray
Copy link
Collaborator

@annashamray annashamray commented Nov 29, 2024

Fixes #472

We use comma as a separator between data_attrs values
If we want to support commas inside values we can consider several options:

  1. Remove several value groups, separated by commas, so comma won't be a reserved character here
    Before: ?data_attrs=naam__icontains__anna,naam__icontains__Advies
    After:?data_attrs=naam__icontains__anna&data_attrs=naam__icontains__Advies, support

    This is my personal favorite option, but it will break current API

  2. Change separator from comma to other character, for example to |.
    Before: ?data_attrs=naam__icontains__anna,naam__icontains__Advies
    After: ?data_attrs=naam__icontains__anna|naam__icontains__Advies, support

    Also a nice option, but also breaks current API

  3. Escape comma in the value part or use other char instead of comma in the value
    Here comma in the value is replaced with \,
    Before: ?data_attrs=naam__icontains__anna,naam__icontains__Advies
    After: ?data_attrs=naam__icontains__anna,naam__icontains__Advies\, support

    This options is implemented in the PR, since it doesn't break the API

  4. Use some regex magic to define when comma is used as separator and when it's used as a part of value.
    Let's not do it, since it's very tricky and unclear what happens

What do you think is the best way to implement it?
Should we introduce the breaking change? The next big release already contains a breaking change, since we remove v1 endpoints

@joeribekker @stevenbal @SonnyBA @Coperh let's discuss it

@annashamray annashamray force-pushed the feature/472-data-attr-contains-comma branch from c98824c to b07f433 Compare December 9, 2024 16:32
@annashamray annashamray marked this pull request as ready for review December 9, 2024 16:55
@joeribekker
Copy link
Member

But, when we discussed this, you said the ," is still seen as a comma and parsed early on?

@annashamray
Copy link
Collaborator Author

@joeribekker Yes, but then I realized that we still can treat \, as not comma. Please take a look at the implementation

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 this pull request may close these issues.

zoeken op waarden met een komma erin, geeft een foutmelding
2 participants