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

CamelCaseKeys does replace keys in arrays #450

Open
boesing opened this issue Nov 12, 2023 · 0 comments
Open

CamelCaseKeys does replace keys in arrays #450

boesing opened this issue Nov 12, 2023 · 0 comments

Comments

@boesing
Copy link
Contributor

boesing commented Nov 12, 2023

Hey there,

I am kinda used to work with laminas-hydrator and JMS.
Both only apply naming strategies only for object properties, which allows responses such as:

{
  "foo": {"bar_foo": "baz", "qoo_bar": true}
}

Which are passed to an object like:

final class Response
{
    /** @param array<string,mixed> $foo */
    public function __construct(public readonly array $foo) {}
}

In both JMS and Laminas Hydrator, the keys of foo won't get modified.
Sadly, the keys in CamelCaseKeys are all modified and thus, some stuff is not properly working as I'd expect it.

I can work around this for now by changing the response to a list of objects containing name and value but I wonder if this is just a niche case or if this should be addressed.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant