Get product fields available for filtering

Hi, everyone!

I’m developing a commercial online store. And in my project, there is a filter menu on the section page (i.e. /catalog/section-slug). How can I get filterable fields for all products in this section?

For example: in my catalog there are two sections “Shoes” and “T-shirts”. Shoes, in addition to the properties “Material”, “Size”, which are identical to the properties in the “T-shirts” section, have a unique boolean property “withLaces” - this property, when marked true, means that the shoes are with laces, when false - shoes with Velcro. Next, when I receive information about the product section, in the “T-shirts” section I need to get all the values for the “Material” and “Size” properties in order to display this in the filter, and in the “Shoes” section I should already receive three properties for filtering “Material”, “Size”, “withLaces”. I’m sure I’m not the first to need this functionality, but I didn’t find an article related to it in the documentation. I will be grateful!