diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php
index 4d47afa..9a9edcc 100644
--- a/core/lib/Drupal/Core/Block/BlockBase.php
+++ b/core/lib/Drupal/Core/Block/BlockBase.php
@@ -85,8 +85,8 @@ protected function baseConfigurationDefaults() {
     return array(
       'id' => $this->getPluginId(),
       'label' => '',
-      'provider' => $this->pluginDefinition['provider'],
       'label_display' => static::BLOCK_LABEL_VISIBLE,
+      'provider' => $this->pluginDefinition['provider'],
     );
   }
 
diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php
index 0128c66..79db0c2 100644
--- a/core/lib/Drupal/Core/Config/Config.php
+++ b/core/lib/Drupal/Core/Config/Config.php
@@ -208,9 +208,7 @@ public function save($has_trusted_data = FALSE) {
       if ($this->typedConfigManager->hasConfigSchema($this->name)) {
         // Ensure that the schema wrapper has the latest data.
         $this->schemaWrapper = NULL;
-        foreach ($this->data as $key => $value) {
-          $this->data[$key] = $this->castValue($key, $value);
-        }
+        $this->data = $this->castValue(NULL, $this->data);
       }
       else {
         foreach ($this->data as $key => $value) {
diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php
index 40a25ef..a32087a 100644
--- a/core/lib/Drupal/Core/Config/StorableConfigBase.php
+++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php
@@ -3,6 +3,7 @@
 namespace Drupal\Core\Config;
 
 use Drupal\Core\Config\Schema\Ignore;
+use Drupal\Core\Config\Schema\Mapping;
 use Drupal\Core\TypedData\PrimitiveInterface;
 use Drupal\Core\TypedData\Type\FloatInterface;
 use Drupal\Core\TypedData\Type\IntegerInterface;
@@ -164,8 +165,9 @@ protected function validateValue($key, $value) {
   /**
    * Casts the value to correct data type using the configuration schema.
    *
-   * @param string $key
-   *   A string that maps to a key within the configuration data.
+   * @param string|null $key
+   *   A string that maps to a key within the configuration data. If NULL the
+   *   top level mapping will be processed.
    * @param string $value
    *   Value to associate with the key.
    *
@@ -176,7 +178,11 @@ protected function validateValue($key, $value) {
    *   If the value is unsupported in configuration.
    */
   protected function castValue($key, $value) {
-    $element = $this->getSchemaWrapper()->get($key);
+    $element = $this->getSchemaWrapper();
+    if ($key !== NULL) {
+      $element = $element->get($key);
+    }
+
     // Do not cast value if it is unknown or defined to be ignored.
     if ($element && ($element instanceof Undefined || $element instanceof Ignore)) {
       // Do validate the value (may throw UnsupportedDataTypeConfigException)
@@ -208,7 +214,17 @@ protected function castValue($key, $value) {
       }
       // Recurse into any nested keys.
       foreach ($value as $nested_value_key => $nested_value) {
-        $value[$nested_value_key] = $this->castValue($key . '.' . $nested_value_key, $nested_value);
+        $lookup_key = $key ? $key . '.' . $nested_value_key : $nested_value_key;
+        $value[$nested_value_key] = $this->castValue($lookup_key, $nested_value);
+      }
+
+      // Only sort maps when we have more than 1 element to sort.
+      if ($element instanceof Mapping && count($value) > 1) {
+        $mapping = $element->getDataDefinition()['mapping'];
+        // Only sort the keys in $value.
+        $mapping = array_intersect_key($mapping, $value);
+        // Sort the array in $value using the mapping definition.
+        $value = array_replace($mapping, $value);
       }
     }
     return $value;
diff --git a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml
index e0232cf..702390e 100644
--- a/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml
+++ b/core/modules/aggregator/config/install/core.entity_view_display.aggregator_feed.aggregator_feed.default.yml
@@ -12,9 +12,9 @@ content:
     type: timestamp_ago
     weight: 1
     region: content
+    label: inline
     settings: {  }
     third_party_settings: {  }
-    label: inline
   description:
     weight: 3
     region: content
@@ -31,8 +31,8 @@ content:
     type: uri_link
     weight: 4
     region: content
+    label: inline
     settings: {  }
     third_party_settings: {  }
-    label: inline
 hidden:
   more_link: true
diff --git a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
index d31c92c..20c56b9 100644
--- a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
+++ b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
@@ -94,8 +94,8 @@ protected function createTests() {
       'settings' => array(
         'id' => 'test_html',
         'label' => '',
-        'provider' => 'block_test',
         'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE,
+        'provider' => 'block_test',
       ),
       'visibility' => array(),
     );
diff --git a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
index c5dfba2..de11b7c 100644
--- a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
+++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
@@ -105,21 +105,21 @@ public function testBlockMigration() {
     $this->assertEntity('user_1', $visibility, 'sidebar_first', 'bartik', 0, '', '0');
 
     $visibility['user_role']['id'] = 'user_role';
-    $roles['authenticated'] = 'authenticated';
-    $visibility['user_role']['roles'] = $roles;
+    $visibility['user_role']['negate'] = FALSE;
     $context_mapping['user'] = '@user.current_user_context:current_user';
     $visibility['user_role']['context_mapping'] = $context_mapping;
-    $visibility['user_role']['negate'] = FALSE;
+    $roles['authenticated'] = 'authenticated';
+    $visibility['user_role']['roles'] = $roles;
     $this->assertEntity('user_2', $visibility, 'sidebar_second', 'bartik', -9, '', '0');
 
     $visibility = [];
     $visibility['user_role']['id'] = 'user_role';
+    $visibility['user_role']['negate'] = FALSE;
+    $context_mapping['user'] = '@user.current_user_context:current_user';
+    $visibility['user_role']['context_mapping'] = $context_mapping;
     $visibility['user_role']['roles'] = [
       'migrate_test_role_1' => 'migrate_test_role_1'
     ];
-    $context_mapping['user'] = '@user.current_user_context:current_user';
-    $visibility['user_role']['context_mapping'] = $context_mapping;
-    $visibility['user_role']['negate'] = FALSE;
     $this->assertEntity('user_3', $visibility, 'sidebar_second', 'bartik', -6, '', '0');
 
     // Check system block
diff --git a/core/modules/book/config/optional/core.entity_form_display.node.book.default.yml b/core/modules/book/config/optional/core.entity_form_display.node.book.default.yml
index 58aba45..b90eb49 100644
--- a/core/modules/book/config/optional/core.entity_form_display.node.book.default.yml
+++ b/core/modules/book/config/optional/core.entity_form_display.node.book.default.yml
@@ -28,17 +28,17 @@ content:
     third_party_settings: {  }
   promote:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 15
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   sticky:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 16
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   title:
     type: string_textfield
diff --git a/core/modules/book/config/optional/core.entity_view_display.node.book.default.yml b/core/modules/book/config/optional/core.entity_view_display.node.book.default.yml
index d6ef64d..f39e28a 100644
--- a/core/modules/book/config/optional/core.entity_view_display.node.book.default.yml
+++ b/core/modules/book/config/optional/core.entity_view_display.node.book.default.yml
@@ -13,10 +13,10 @@ bundle: book
 mode: default
 content:
   body:
-    label: hidden
     type: text_default
     weight: 100
     region: content
+    label: hidden
     settings: {  }
     third_party_settings: {  }
   links:
diff --git a/core/modules/book/config/optional/core.entity_view_display.node.book.teaser.yml b/core/modules/book/config/optional/core.entity_view_display.node.book.teaser.yml
index 77a62c3..619ca71 100644
--- a/core/modules/book/config/optional/core.entity_view_display.node.book.teaser.yml
+++ b/core/modules/book/config/optional/core.entity_view_display.node.book.teaser.yml
@@ -14,10 +14,10 @@ bundle: book
 mode: teaser
 content:
   body:
-    label: hidden
     type: text_summary_or_trimmed
     weight: 100
     region: content
+    label: hidden
     settings:
       trim_length: 600
     third_party_settings: {  }
diff --git a/core/modules/book/config/optional/core.entity_view_mode.node.print.yml b/core/modules/book/config/optional/core.entity_view_mode.node.print.yml
index d615b03..d695ac5 100644
--- a/core/modules/book/config/optional/core.entity_view_mode.node.print.yml
+++ b/core/modules/book/config/optional/core.entity_view_mode.node.print.yml
@@ -1,11 +1,11 @@
 langcode: en
 status: false
 dependencies:
+  module:
+    - node
   enforced:
     module:
       - book
-  module:
-    - node
 id: node.print
 label: Print
 targetEntityType: node
diff --git a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml
index c10e268..e192a30 100644
--- a/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml
+++ b/core/modules/config/tests/config_schema_test/config/schema/config_schema_test.schema.yml
@@ -297,3 +297,18 @@ test.double_brackets.breed:
   mapping:
     breed:
       type: string
+
+config_schema_test.schema_mapping_sort:
+  type: config_object
+  mapping:
+    bar:
+      type: string
+    foo:
+      type: string
+    map:
+      type: mapping
+      mapping:
+        sub_foo:
+          type: string
+        sub_bar:
+          type: string
diff --git a/core/modules/content_moderation/config/install/workflows.workflow.editorial.yml b/core/modules/content_moderation/config/install/workflows.workflow.editorial.yml
index d8daa51..96d7a83 100644
--- a/core/modules/content_moderation/config/install/workflows.workflow.editorial.yml
+++ b/core/modules/content_moderation/config/install/workflows.workflow.editorial.yml
@@ -5,6 +5,19 @@ dependencies:
     - content_moderation
 id: editorial
 label: 'Editorial workflow'
+type: content_moderation
+type_settings:
+  states:
+    archived:
+      published: false
+      default_revision: true
+    draft:
+      published: false
+      default_revision: false
+    published:
+      published: true
+      default_revision: true
+  entity_types: {  }
 states:
   archived:
     label: Archived
@@ -48,16 +61,3 @@ transitions:
       - published
     to: published
     weight: 1
-type: content_moderation
-type_settings:
-  states:
-    archived:
-      published: false
-      default_revision: true
-    draft:
-      published: false
-      default_revision: false
-    published:
-      published: true
-      default_revision: true
-  entity_types: {  }
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php
index e7bb636..2d30d91 100644
--- a/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldWidgetSettingsTest.php
@@ -30,10 +30,16 @@ public function testWidgetSettings() {
 
     // Text field.
     $component = $form_display->getComponent('field_test');
-    $expected = array('weight' => 1, 'type' => 'text_textfield');
-    $expected['settings'] = array('size' => 60, 'placeholder' => '');
-    $expected['third_party_settings'] = array();
-    $expected['region'] = 'content';
+    $expected = array(
+      'type' => 'text_textfield',
+      'weight' => 1,
+      'region' => 'content',
+      'settings' => array(
+        'size' => 60,
+        'placeholder' => '',
+      ),
+      'third_party_settings' => array(),
+    );
     $this->assertIdentical($expected, $component, 'Text field settings are correct.');
 
     // Integer field.
diff --git a/core/modules/forum/config/optional/core.entity_form_display.node.forum.default.yml b/core/modules/forum/config/optional/core.entity_form_display.node.forum.default.yml
index 6773d32..8751d50 100644
--- a/core/modules/forum/config/optional/core.entity_form_display.node.forum.default.yml
+++ b/core/modules/forum/config/optional/core.entity_form_display.node.forum.default.yml
@@ -37,17 +37,17 @@ content:
     third_party_settings: {  }
   promote:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 15
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   sticky:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 16
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   taxonomy_forums:
     type: options_select
diff --git a/core/modules/forum/config/optional/core.entity_view_display.comment.comment_forum.default.yml b/core/modules/forum/config/optional/core.entity_view_display.comment.comment_forum.default.yml
index befeba8..72ef82b 100644
--- a/core/modules/forum/config/optional/core.entity_view_display.comment.comment_forum.default.yml
+++ b/core/modules/forum/config/optional/core.entity_view_display.comment.comment_forum.default.yml
@@ -12,10 +12,10 @@ bundle: comment_forum
 mode: default
 content:
   comment_body:
-    label: hidden
     type: text_default
     weight: 0
     region: content
+    label: hidden
     settings: {  }
     third_party_settings: {  }
   links:
diff --git a/core/modules/forum/config/optional/core.entity_view_display.node.forum.default.yml b/core/modules/forum/config/optional/core.entity_view_display.node.forum.default.yml
index f3e8c5c..2570925 100644
--- a/core/modules/forum/config/optional/core.entity_view_display.node.forum.default.yml
+++ b/core/modules/forum/config/optional/core.entity_view_display.node.forum.default.yml
@@ -17,17 +17,17 @@ bundle: forum
 mode: default
 content:
   body:
-    label: hidden
     type: text_default
     weight: 0
     region: content
+    label: hidden
     settings: {  }
     third_party_settings: {  }
   comment_forum:
-    label: hidden
     type: comment_default
     weight: 20
     region: content
+    label: hidden
     settings:
       view_mode: default
       pager_id: 0
diff --git a/core/modules/forum/config/optional/core.entity_view_display.node.forum.teaser.yml b/core/modules/forum/config/optional/core.entity_view_display.node.forum.teaser.yml
index 7b174f4..eb1c3d3 100644
--- a/core/modules/forum/config/optional/core.entity_view_display.node.forum.teaser.yml
+++ b/core/modules/forum/config/optional/core.entity_view_display.node.forum.teaser.yml
@@ -16,10 +16,10 @@ bundle: forum
 mode: teaser
 content:
   body:
-    label: hidden
     type: text_summary_or_trimmed
     weight: 100
     region: content
+    label: hidden
     settings:
       trim_length: 600
     third_party_settings: {  }
diff --git a/core/modules/forum/config/optional/core.entity_view_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/optional/core.entity_view_display.taxonomy_term.forums.default.yml
index b326039..aecec5b 100644
--- a/core/modules/forum/config/optional/core.entity_view_display.taxonomy_term.forums.default.yml
+++ b/core/modules/forum/config/optional/core.entity_view_display.taxonomy_term.forums.default.yml
@@ -15,8 +15,8 @@ content:
     type: text_default
     weight: 0
     region: content
+    label: above
     settings: {  }
     third_party_settings: {  }
-    label: above
 hidden:
   forum_container: true
diff --git a/core/modules/forum/config/optional/field.field.node.forum.comment_forum.yml b/core/modules/forum/config/optional/field.field.node.forum.comment_forum.yml
index 8812273..e5edd7e 100644
--- a/core/modules/forum/config/optional/field.field.node.forum.comment_forum.yml
+++ b/core/modules/forum/config/optional/field.field.node.forum.comment_forum.yml
@@ -18,15 +18,15 @@ default_value:
   -
     status: 2
     cid: 0
-    last_comment_name: null
     last_comment_timestamp: 0
+    last_comment_name: null
     last_comment_uid: 0
     comment_count: 0
 default_value_callback: ''
 settings:
   default_mode: 0
   per_page: 50
-  form_location: true
   anonymous: 0
+  form_location: true
   preview: 1
 field_type: comment
diff --git a/core/modules/image/config/schema/image.schema.yml b/core/modules/image/config/schema/image.schema.yml
index 0006ad7..4276644 100644
--- a/core/modules/image/config/schema/image.schema.yml
+++ b/core/modules/image/config/schema/image.schema.yml
@@ -14,14 +14,14 @@ image.style.*:
       sequence:
         type: mapping
         mapping:
+          uuid:
+            type: string
           id:
             type: string
-          data:
-            type: image.effect.[%parent.id]
           weight:
             type: integer
-          uuid:
-            type: string
+          data:
+            type: image.effect.[%parent.id]
 
 image.effect.*:
   type: mapping
diff --git a/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php b/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php
index c8e800b..41b1d52 100644
--- a/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php
+++ b/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateSystemConfigurationTest.php
@@ -26,20 +26,20 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
       'logging' => 1,
     ],
     'system.date' => [
+      'first_day' => 4,
       // country is not handled by the migration.
       'country' => [
         'default' => '',
       ],
-      'first_day' => 4,
       // timezone is not handled by the migration.
       'timezone' => [
         'default' => 'Europe/Paris',
         'user' => [
           'configurable' => FALSE,
-          // warn is not handled by the migration.
-          'warn' => FALSE,
           // default is not handled by the migration.
           'default' => 0,
+          // warn is not handled by the migration.
+          'warn' => FALSE,
         ],
       ],
     ],
@@ -63,9 +63,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
       'error_level' => 'some',
     ],
     'system.maintenance' => [
-      'message' => 'Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.',
       // langcode is not handled by the migration.
       'langcode' => 'en',
+      'message' => 'Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.',
     ],
     'system.performance' => [
       'cache' => [
@@ -90,13 +90,15 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
         // gzip is not handled by the migration.
         'gzip' => TRUE,
       ],
-      // stale_file_threshold is not handled by the migration.
-      'stale_file_threshold' => 2592000,
       'response' => [
         'gzip' => TRUE,
       ],
+      // stale_file_threshold is not handled by the migration.
+      'stale_file_threshold' => 2592000,
     ],
     'system.rss' => [
+      // langcode is not handled by the migration.
+      'langcode' => 'en',
       // channel is not handled by the migration.
       'channel' => [
         'description' => '',
@@ -105,10 +107,10 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
         'limit' => 10,
         'view_mode' => 'title',
       ],
-      // langcode is not handled by the migration.
-      'langcode' => 'en',
     ],
     'system.site' => [
+      // langcode and default_langcode are not handled by the migration.
+      'langcode' => 'en',
       // uuid is not handled by the migration.
       'uuid' => '',
       'name' => 'site_name',
@@ -121,8 +123,6 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
       ],
       'admin_compact_mode' => FALSE,
       'weight_select_max' => 100,
-      // langcode and default_langcode are not handled by the migration.
-      'langcode' => 'en',
       'default_langcode' => 'en',
     ],
   ];
diff --git a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php
index 22e9ba7..9da5ea1 100644
--- a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php
+++ b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateSystemConfigurationTest.php
@@ -27,17 +27,17 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
       'logging' => 1,
     ],
     'system.date' => [
+      'first_day' => 1,
       'country' => [
         'default' => 'US',
       ],
-      'first_day' => 1,
       'timezone' => [
         'default' => 'America/Chicago',
         'user' => [
           'configurable' => TRUE,
-          'warn' => TRUE,
           // DRUPAL_USER_TIMEZONE_SELECT (D7 API)
           'default' => 2,
+          'warn' => TRUE,
         ],
       ],
     ],
@@ -66,9 +66,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
       ],
     ],
     'system.maintenance' => [
-      'message' => 'This is a custom maintenance mode message.',
       // langcode is not handled by the migration.
       'langcode' => 'en',
+      'message' => 'This is a custom maintenance mode message.',
     ],
     'system.performance' => [
       'cache' => [
@@ -93,13 +93,14 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
         // gzip is not handled by the migration.
         'gzip' => TRUE,
       ],
-      // stale_file_threshold is not handled by the migration.
-      'stale_file_threshold' => 2592000,
       'response' => [
         'gzip' => TRUE,
       ],
+      // stale_file_threshold is not handled by the migration.
+      'stale_file_threshold' => 2592000,
     ],
     'system.rss' => [
+      'langcode' => 'en',
       'channel' => [
         'description' => '',
       ],
@@ -107,9 +108,10 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
         'limit' => 27,
         'view_mode' => 'fulltext',
       ],
-      'langcode' => 'en',
     ],
     'system.site' => [
+      // langcode and default_langcode are not handled by the migration.
+      'langcode' => 'en',
       // uuid is not handled by the migration.
       'uuid' => '',
       'name' => 'The Site Name',
@@ -122,8 +124,6 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
       ],
       'admin_compact_mode' => TRUE,
       'weight_select_max' => 40,
-      // langcode and default_langcode are not handled by the migration.
-      'langcode' => 'en',
       'default_langcode' => 'en',
     ],
   ];
diff --git a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserFloodTest.php b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserFloodTest.php
index af2eec9..1508adc 100644
--- a/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserFloodTest.php
+++ b/core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserFloodTest.php
@@ -25,14 +25,14 @@ protected function setUp() {
    */
   public function testMigration() {
     $expected = [
+      '_core' => [
+        'default_config_hash' => 'UYfMzeP1S8jKm9PSvxf7nQNe8DsNS-3bc2WSNNXBQWs',
+      ],
       'uid_only' => TRUE,
       'ip_limit' => 30,
       'ip_window' => 7200,
       'user_limit' => 22,
       'user_window' => 86400,
-      '_core' => [
-        'default_config_hash' => 'UYfMzeP1S8jKm9PSvxf7nQNe8DsNS-3bc2WSNNXBQWs',
-      ],
     ];
     $this->assertIdentical($expected, $this->config('user.flood')->get());
   }
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
index 8a39d64..2ea8e4f 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
@@ -353,23 +353,23 @@ public function testConfigSaveWithSchema() {
     $untyped_to_typed = $untyped_values;
 
     $typed_values = array(
-      'string' => '1',
-      'empty_string' => '',
-      'null_string' => NULL,
+      'config_schema_test_integer' => 1,
+      'config_schema_test_integer_empty_string' => NULL,
       'integer' => 100,
       'null_integer' => NULL,
+      'float' => 3.14,
+      'null_float' => NULL,
+      'string' => '1',
+      'null_string' => NULL,
+      'empty_string' => '',
       'boolean' => TRUE,
       'no_type' => 1,
       'mapping' => array(
         'string' => '1'
       ),
-      'float' => 3.14,
-      'null_float' => NULL,
       'sequence' => array (TRUE, FALSE, TRUE),
       'sequence_bc' => array(TRUE, FALSE, TRUE),
       'not_present_in_schema' => TRUE,
-      'config_schema_test_integer' => 1,
-      'config_schema_test_integer_empty_string' => NULL,
     );
 
     // Save config which has a schema that enforces types.
@@ -396,6 +396,24 @@ public function testConfigSaveWithSchema() {
   }
 
   /**
+   * Test configuration value data type enforcement using schemas.
+   */
+  public function testConfigSaveMappingSort() {
+    // Top level map sorting.
+    $data = [
+      'foo' => '1',
+      'bar' => '2',
+    ];
+    // Save config which has a schema that enforces types.
+    $this->config('config_schema_test.schema_mapping_sort')
+      ->setData($data)
+      ->save();
+    $this->assertSame(['bar' => '2', 'foo' => '1'], $this->config('config_schema_test.schema_mapping_sort')->get());
+    $this->config('config_schema_test.schema_mapping_sort')->set('map', ['sub_bar' => '2', 'sub_foo' => '1'])->save();
+    $this->assertSame(['sub_foo' => '1', 'sub_bar' => '2'], $this->config('config_schema_test.schema_mapping_sort')->get('map'));
+  }
+
+  /**
    * Tests fallback to a greedy wildcard.
    */
   function testSchemaFallback() {
@@ -522,9 +540,9 @@ public function testConfigSaveWithWrappingSchema() {
     $typed_values = [
       'tests' => [
         [
-          'wrapper_value' => 'foo',
           'plugin_id' => 'wrapper:foo',
           'internal_value' => '100',
+          'wrapper_value' => 'foo',
         ],
       ],
     ];
@@ -557,10 +575,10 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() {
     $typed_values = [
       'tests' => [
         [
-          'wrapper_value' => 'foo',
+          'another_key' => 100,
           'foo' => 'turtle',
           'bar' => 'horse',
-          'another_key' => 100,
+          'wrapper_value' => 'foo',
         ],
       ],
     ];
@@ -591,10 +609,10 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() {
     $typed_values = [
       'tests' => [
         [
-          'wrapper_value' => 'foo',
+          'another_key' => '100',
           'foo' => 'cat',
           'bar' => 'dog',
-          'another_key' => '100',
+          'wrapper_value' => 'foo',
         ],
       ],
     ];
