Describe the bug
Without uSync.Complete, the configuration for a block list is immediately serialized using JsonConvert.SerializeObject, with json settings using uSyncContractResolver to handle ordering the properties alphabetically. See line here
uSync.Complete appears to add a data type serializer for block lists that does not use these same json settings to order the properties, resulting in different file structures depending on if you have this installed or not.
This causes an issue for us as we programmatically generate these files for multiple projects, some using uSync.Complete and others not, causing half our projects to show changes due to the slightly difference in the structure of these files.
Version (please complete the following information):
- Umbraco Version: 13.5.2
- uSync Version: 13.2.5
- uSync.Complete Version: 13.1.8
To Reproduce
Steps to reproduce the behavior:
- With only the uSync nuget package installed, create and/or save a block list data type.
- Observe the order of the
Config property in the generated config file is alphabetical:
<?xml version="1.0" encoding="utf-8"?>
<DataType Key="21b4c2fa-6e23-5e22-a533-ba4e203eeb7b" Alias="FilmListDisplayTextLoader" Level="3">
<Info>
<Name>FilmListDisplayTextLoader</Name>
<EditorAlias>Umbraco.BlockList</EditorAlias>
<DatabaseType>Ntext</DatabaseType>
<Folder>Feature/FilmList</Folder>
</Info>
<Config><![CDATA[{
"Blocks": [
{
"backgroundColor": null,
"contentElementTypeKey": "2f2f59f7-d449-5824-8131-fb0313066ae6",
"editorSize": "medium",
"forceHideContentEditorInOverlay": false,
"iconColor": null,
"label": "Film List Display Text",
"settingsElementTypeKey": null,
"stylesheet": null,
"thumbnail": null,
"view": null
}
],
"MaxPropertyWidth": null,
"UseInlineEditingAsDefault": true,
"UseLiveEditing": false,
"UseSingleBlockMode": true,
"ValidationLimit": {
"max": 1,
"min": 1
}
}]]></Config>
</DataType>
- Install uSync.Complete, and re-save the block list data type
- Observe that the JSON is no longer alphabetical, instead ordered by the structure of the underlying model (In this case Umbraco.Cms.Core.PropertyEditors.BlockListConfiguration)
<?xml version="1.0" encoding="utf-8"?>
<DataType Key="21b4c2fa-6e23-5e22-a533-ba4e203eeb7b" Alias="FilmListDisplayTextLoader" Level="3">
<Info>
<Name>FilmListDisplayTextLoader</Name>
<EditorAlias>Umbraco.BlockList</EditorAlias>
<DatabaseType>Ntext</DatabaseType>
<Folder>Feature/FilmList</Folder>
</Info>
<Config><![CDATA[{
"Blocks": [
{
"backgroundColor": null,
"iconColor": null,
"thumbnail": null,
"contentElementTypeKey": "2f2f59f7-d449-5824-8131-fb0313066ae6",
"settingsElementTypeKey": null,
"view": null,
"stylesheet": null,
"label": "Film List Display Text",
"editorSize": "medium",
"forceHideContentEditorInOverlay": false
}
],
"ValidationLimit": {
"min": 1,
"max": 1
},
"UseSingleBlockMode": true,
"UseLiveEditing": false,
"UseInlineEditingAsDefault": true,
"MaxPropertyWidth": null
}]]></Config>
</DataType>
Expected behavior
The JSON should always be ordered alphabetically, per the 10.1 file format
Describe the bug
Without uSync.Complete, the configuration for a block list is immediately serialized using
JsonConvert.SerializeObject, with json settings usinguSyncContractResolverto handle ordering the properties alphabetically. See line hereuSync.Complete appears to add a data type serializer for block lists that does not use these same json settings to order the properties, resulting in different file structures depending on if you have this installed or not.
This causes an issue for us as we programmatically generate these files for multiple projects, some using uSync.Complete and others not, causing half our projects to show changes due to the slightly difference in the structure of these files.
Version (please complete the following information):
To Reproduce
Steps to reproduce the behavior:
Configproperty in the generated config file is alphabetical:Expected behavior
The JSON should always be ordered alphabetically, per the 10.1 file format