nova-json
nova-json copied to clipboard
Fix removing to much when creating a dotted attribute key
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.
@gisostallenberg, can you please post the code which defines the nested JSON field?
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'),
])
])
Is there some other fields or panel defined which wraps around the JSON definition?