membrane-php / membrane-core

Membrane is a general purpose input validation library, supports both PHP Attributes and OpenAPI specifications
Other
1 stars 2 forks source link

Add QueryStringToArray Filter #168

Closed charjr closed 9 months ago

charjr commented 9 months ago

This filter

  1. explodes on & into segments.

  2. explodes each value on = into pairs.

  3. inserts each pair as a key-value pair into an array (without overwriting)

The result is an array<string,string[]>

See the test for example outputs.

What this does is handle collecting the data together based on properties, after which it will still need to handle the style elsewhere. This can be added to the beforeSet for query parameters, something in each field processor will need to handle individual styles.

A combination of differing styles and explodes should not cause issue referring to this: https://github.com/OAI/OpenAPI-Specification/issues/1508