Cockpit-HQ / Cockpit

Cockpit Core - Content Platform
https://getcockpit.com
Other
388 stars 47 forks source link

[PREF]: "underscore_keys" filter #226

Open mountainash opened 4 weeks ago

mountainash commented 4 weeks ago

Requests to the Cockpit /page APIs often return a very large results as there's many keys and values that are rarely used. Adding an easy way to remove them would reduce the payload size, transfer time and processing. Can I suggest that a single/simple filter is added to remove the following fields (aka the “underscore_keys”):

The filter could also remove the “image meta data” (as it’s also not often used). This would remove the following image child fields:

Obviously calling the new filter combined with an explicit filter:{colors:1,_state:1} would re-add those key/values.

This often results in a 30+% size saving!