[wp-trac] [WordPress Trac] #48079: REST API: optimize how the schema API is generated for block-renderer endpoints

WordPress Trac noreply at wordpress.org
Wed Jun 17 03:20:18 UTC 2020


#48079: REST API: optimize how the schema API is generated for block-renderer
endpoints
-------------------------+--------------------------------
 Reporter:  gziolo       |       Owner:  TimothyBlynJacobs
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  5.5
Component:  REST API     |     Version:
 Severity:  normal       |  Resolution:  fixed
 Keywords:               |     Focuses:
-------------------------+--------------------------------
Changes (by TimothyBlynJacobs):

 * owner:  (none) => TimothyBlynJacobs
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"48069" 48069]:
 {{{
 #!CommitTicketReference repository="" revision="48069"
 REST API: Only register one block renderer route.

 Every block has a different set of attributes. These attributes are
 specified as a JSON Schema object. Previously, every block registered its
 own block renderer route using its attributes for the schema. This allowed
 for the attributes to be validated using the built in endpoint validation
 rules. It had the unfortunate side effect, however, of creating a large
 number of nearly identical REST API routes, one for each dynamic block.
 Each registered route has a performance impact. As the number of server
 side blocks goes up, this becomes more and more of an issue.

 Now, we register a single block renderer route and dynamically validate
 the attributes based on the selected block.

 Fixes #48079.
 Props gziolo, TimothyBlynJacobs.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48079#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list