Skip to content

Conversation

@gisostallenberg
Copy link
Contributor

When having a JSON structure with nested data with a key ending (or being the same as the parent property to much is removed from the attribute when it is converted into a dotted key.

Example:

{
  "settings": {
    "personal_settings": {
      "darkmode": true
    }
}

Without this fix a call to getDottedAttributeKey will give the attribute personal_darkmode instead of the expected personal_settings.darkmode.

When having a JSON structure with nested data with a key ending (or being the same as the parent property to much is removed from the attribute when it is converted into a dotted key.
Example:
```json
{
  "settings": {
    "personal_settings": {
      "darkmode": true
    }
}
```

Without this fix a call to `getDottedAttributeKey` will give the attribute `personal_darkmode` instead of the expected `personal_settings.darkmode`.
@Naoray
Copy link
Owner

Naoray commented Aug 3, 2023

@gisostallenberg, can you please post the code which defines the nested JSON field?

@gisostallenberg
Copy link
Contributor Author

Because the issue occurs in a private project the initial example is made up.
The fields are generated from some nested classes, so I'm not 100% sure if the code below is accurate, but I think so.

JSON::make('settings', [
   JSON::make('personal_settings', [
       Boolean::make('darkmode', 'darkmode'),
   ])
])

@Naoray
Copy link
Owner

Naoray commented Aug 4, 2023

Is there some other fields or panel defined which wraps around the JSON definition?

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

Successfully merging this pull request may close these issues.

2 participants