#38586 closed task (blessed) (fixed)
REST API: Allow arrays to be sent as CSVs
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | needs-docs |
Focuses: | Cc: |
Change History (13)
#3
@
8 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This needs to be documented further, and we should check whether this is the best way to implement it. Right now, there's no hint to the client that "array" means you can send CSV as well. Potentially, using JSON Schema's anyOf
would be better here.
#4
@
8 years ago
I'm cool with whatever option. Everywhere endpoint parameters have the type array
, we also want to allow CSV.
Actually, I'd be fine with just documenting that, and leaving it, particularly as changing the type in the endpoint docs will be confusing. Apps that care about JSON Schema can send actual arrays, apps that don't can send either.
#5
@
8 years ago
I'm OK with that too, so long as it's documented. If we can come up with a standard, self-documenting way though, probably best to do that.
#6
@
8 years ago
I would really like to see anyOf or oneOf, etc. being used. Currently I'm going to need to add my own validation callbacks for handling those more complex schema, but it'd be great if something like that is handled in core.
#7
@
8 years ago
- Keywords needs-docs added
Updating schema.html to say "array or CSV" will do the job, but I don't know what the plan is for merging the API docs to devhub.
#8
@
8 years ago
Hmm I'm not too keen on this approach, and I think this was committed without too much consideration to different types etc. It appears this would also need a modification to the sanitizer also, as right now, it doesn't look like this is doing both validation and sanitization.
Just because the value isn't an array doesn't mean we can pass it to preg_split
, what if it's other types?
This ticket was mentioned in Slack in #core-restapi by joehoyle. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-restapi by joehoyle. View the logs.
8 years ago
#12
@
8 years ago
- Resolution set to fixed
- Status changed from reopened to closed
In #38617 I audited all the endpoints to make sure we are using array
/ type
combos wherever we can. These all support CSVs by default now, thanks to this ticket - given we haven't run into any issues in all those instances I think it's safe to say this was a good thing to do so I'm closing it out.
In 39048: