+
Skip to content

Keys with null values omitted from any filled array, even if the key and null value is desired #61

@bryan-lee-git

Description

@bryan-lee-git

This block of code in src/Utilities/Arr.php recursively omits all array keys that have null values

if (is_array($value)) {
    $value = static::filter($value);
    continue;
}

When building OAS documentation, you often want to keep keys with null values to show that, for example, a return value in an API response payload may contain null values but still include the keys for those values.

My team has forked this repo as well as the vyuldashev/laravel-open-api package employing this one in order to get around the issue and correctly generate our Open API docs. In the fork we have commented out this block of code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载