membrane-php / membrane-core

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

Support Parameters "in":"header" or "in":"cookie" #116

Open charjr opened 1 year ago

charjr commented 1 year ago

Membrane does not support header and cookie parameters currently.

The issue is that all header and cookie payloads come out as an array, which conflicts with trying to validate types that aren't arrays.

The solution may be to include a BeforeSet that, for non-array values, checks the array only contains one item and that the item is the specified "type". Then an Afterset that flattens the array.