Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bryan-lee-git opened this issue Jun 15, 2023 · 0 comments

Comments

@bryan-lee-git
Copy link

bryan-lee-git commented Jun 15, 2023

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.

@bryan-lee-git bryan-lee-git changed the title null values omitted from any filled array, even if the null is desired Keys with null values omitted from any filled array, even if the key and null value is desired Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant