[wp-trac] [WordPress Trac] #38131: REST API: Provide interface to include or exclude specific fields from response JSON
WordPress Trac
noreply at wordpress.org
Sun May 7 05:12:39 UTC 2017
#38131: REST API: Provide interface to include or exclude specific fields from
response JSON
-------------------------+--------------------------
Reporter: kadamwhite | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.8
Component: REST API | Version: 4.4
Severity: normal | Resolution:
Keywords: | Focuses: performance
-------------------------+--------------------------
Comment (by joehoyle):
I'm +1 on this. I think we should probably handle embeds and object fields
as two issues. Choosing _which_ embeds could potentially be part of the
"object fields", but once we get into whitelisting fields of specific
embeds I think we are getting into GraphQL territory. While I think there
may be merit in such a thing, I think a good first milestone would be
whitelisting embeds and specific fields of the main requested object.
I think the patch by @adamsilverstein is a good start - we could roll with
something like this for now, and then add internal optimizations in follow
up patches / releases. As @jnylen0 pointed out we already do a good amount
of schema checking. I think there might be potentially to actually have
`get_item_schema()` take into account the requested fields; or do the
"diff" early, so then we don't need to change any of the code that does
`isset( $schema['title'] )` etc, so we can just keep that pattern, and
implement it on more controllers and fields over time.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38131#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list