-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Datatype configuration refactor #13605
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… models for create and update
# Conflicts: # src/Umbraco.Cms.Api.Management/DependencyInjection/MappingBuilderExtensions.cs
bergmania
approved these changes
Dec 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
In the current backoffice, the server is fully in charge of datatype configurations; every configuration field has to be explicitly defined serverside, and only those fields will be persisted to the datatype configuration - no matter what the client might attempt to save.
In the new backoffice, the server won't know anything about datatype configurations except what is necessary for validation purposes. For example, the server must know about the
maxChars
configuration for a textarea datatype in order to perform editor validation, but it should never know nor care about therows
configuation, because this is purely a clientside presentation configuration.This PR is a complete rework of how datatype configuration is stored and handled, in order to facilitate the new backoffice requirements listed above.
This is not a clean-up of the current ways of handling datatype configuration. On the contrary, some work has been put in to retain the current datatype configuration handling, so datatype configuration continues to work (almost) within the current backoffice, and so the rest of the backoffice doesn't explode due to this datatype configuration rework - for example, content type configuration and content editing both rely on this backwards compatibility.
This is also not an implementation of datatype controllers for the new management API. However, in order to test the whole rework, rudimentary datatype controllers for the new management API have been added to this PR. These will be mended in a future PR, among other things to include:
On a curious note, the current backoffice uses
Newtonsoft.Json
for (de)serialization and JSON handling while the new management API usesSystem.Text.Json
. Therefore a temporary datatype configuration serializer has been put in place in an attempt to handle both simultaneously - theContextualConfigurationEditorJsonSerializer
.Limitations of this PR
This PR performs a general clean-up of all known datatype configurations (see
MigrateDataTypeConfigurations
) to make up for years and years of inconsistency (since V7) in datatype configuration formatting. A few datatypes are also handled explicitly to either reformat or sanitize known configuration issues, while others remain unhandled. Specifically color pickers and list views are known to have issues at this point. We can't do anything about those datatypes now, because we first need to define their future configuration format in order to perform a configuration migration. This will be handled in a separate task, and the migration will be amended to handle all known datatypes. Thus at some point it will be necessary to re-test this PR in conjunction with the PR for this separate task.The
ContextualConfigurationEditorJsonSerializer
almost works. Due to a caching issue, the current backoffice almost consequently breaks when updating a datatype using the new management API. A reboot of the site fixes this caching issue. Since it's a temporary workaround to have two configuration serializers, we won't put more work into trying to solve the caching issue at this point. It should resolve itself once we can get rid ofNewtonsoft.Json
.Testing this PR
Get in touch with KJA for a copy of the datatype Postman collection for the new management API.
ContextualConfigurationEditorJsonSerializer
.data
collection).Bonus test
As it happens, neither the textbox nor the textarea datatypes perform serverside validation of the
maxChars
configuration. This is likely an oversight, but we can use it to test this PR.In
TextAreaPropertyEditor
, remove theCreateValueEditor()
implementation and then add the following to the class:Now perform the following steps:
maxChars
set to 20