Link with `null` attribute
weierophinney opened this issue · comments
Creating a Link with a null
attribute, I get an InvalidArgumentException
. I'm not 100% sure about it but I guess that having null
attributes should be allowed in Hal links
Code to reproduce the issue
new Link('a', 'b', false, ['c' => null]);
Expected results
I would expect to get a Link
with a c
attribute with a null
value
Actual results
An InvalidArgumentException
with message Zend\\Expressive\\Hal\\Link expects the $value to be a PHP primitive or array of strings; received NULL
is thrown
Originally posted by @marcosh at zendframework/zend-expressive-hal#46
Latest draft for HAL defines Link object with attributes that are optional but not empty.
https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-08#section-5
I do not think attributes with null values should be allowed.