[wp-trac] [WordPress Trac] #38926: REST API: Validate thumbnail ID in response
WordPress Trac
noreply at wordpress.org
Thu Nov 24 19:09:22 UTC 2016
#38926: REST API: Validate thumbnail ID in response
--------------------------+------------------------------
Reporter: iseulde | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: minor | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by joehoyle):
Good question - I'm not totally sure of the behaviour too. Perhaps we
could not link to it if it's not found, but still put the value in the
response. As WordPress actually just lets you store any ID in the field,
it's plausible that people could be using it for something other than an
attachment ID I guess.
This is part of a broader question that has come up before: what do we do
with data that is already stored, that is technically not valid. Ignoring
the data from the REST API output also makes round-trips of that data very
difficult, as we have to make a lot of exceptions on data validation.
I'm tempted to err on the side of a clean API, rather than misconfigured
data, though that's probably a controversial view. If there's an invalid
ID stored in thumbnail_id, the API would output it as `null`, if you
updated the resource, it would then set the thumbnail ID to `null`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38926#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list