support commas in data_attrs query param#488
Conversation
c98824c to
b07f433
Compare
|
But, when we discussed this, you said the ," is still seen as a comma and parsed early on? |
|
@joeribekker Yes, but then I realized that we still can treat |
8bfcc82 to
47bd81f
Compare
stevenbal
left a comment
There was a problem hiding this comment.
Minor comments, looks good overall 👍
| * only one filtering expression is allowed | ||
|
|
||
| If you want to use several filtering expressions, just use this `data_attr` several times in the query string. | ||
| Example: `data_attr=height__exact__100&data_attr=naam__icontains__boom` |
There was a problem hiding this comment.
Nitpicky, but ideally explode: true would be specified here to indicate that it should be used like ?data_attr=...&data_attr=... (see https://swagger.io/docs/specification/v3_0/serialization/#query-parameters)
Although looking at it, apparently explode: true is considered the default by OAS3, so I'm not sure if our schema is correct in that case 🤔. Might be something to investigate in another issue
There was a problem hiding this comment.
I've added it to the OAS and created issue to investigate all filters #498
…ns-comma support commas in data_attrs query param
Fixes #472
We use comma as a separator between
data_attrsvaluesIf 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__AdviesAfter:
?data_attrs=naam__icontains__anna&data_attrs=naam__icontains__Advies, supportThis 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__AdviesAfter:
?data_attrs=naam__icontains__anna|naam__icontains__Advies, supportAlso 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__AdviesAfter:
?data_attrs=naam__icontains__anna,naam__icontains__Advies\, supportThis 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