support commas in data_attrs query param #488
Open
+78
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #472
We use comma as a separator between
data_attrs
valuesIf we want to support commas inside values we can consider several options:
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
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
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
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