Commit 7a98471c authored by alexpott's avatar alexpott

Issue #2273631 by vijaycs85: Unify config entity schemas with a base schema type.

parent beca96c5
......@@ -231,3 +231,25 @@ config_dependencies:
label: 'Theme dependencies'
sequence:
- type: string
config_entity:
type: mapping
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Status'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Schema for the configuration files of the Block module.
block.block.*:
type: mapping
type: config_entity
label: 'Block'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
theme:
type: string
label: 'Theme'
......@@ -22,9 +16,6 @@ block.block.*:
provider:
type: string
label: 'Provider'
status:
type: boolean
label: 'Status'
visibility:
type: mapping
label: 'Visibility settings'
......@@ -97,9 +88,3 @@ block.block.*:
provider:
type: string
label: 'Provider'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Schema for the configuration files of the Custom Block module.
custom_block.type.*:
type: mapping
type: config_entity
label: 'Custom block type settings'
mapping:
id:
type: string
label: 'Machine-readable name'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
revision:
type: integer
label: 'Create new revision'
description:
type: text
label: 'Description'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
# Schema for the configuration files of the Breakpoint module.
breakpoint.breakpoint.*.*.*:
type: mapping
type: config_entity
label: 'Defines the Breakpoint entity'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
name:
type: string
label: 'Machine name'
label:
type: string
label: 'Label'
mediaQuery:
type: string
label: 'Media query'
......@@ -33,32 +24,14 @@ breakpoint.breakpoint.*.*.*:
sequence:
- type: string
label: 'Multiplier'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
breakpoint.breakpoint_group.*.*.*:
type: mapping
type: config_entity
label: 'Breakpoint group settings'
mapping:
id:
type: string
label: 'Group ID'
uuid:
type: string
label: 'UUID'
name:
type: string
label: 'Machine name'
label:
type: string
label: 'Label'
breakpoint_ids:
type: sequence
label: 'Breakpoints'
......@@ -71,12 +44,3 @@ breakpoint.breakpoint_group.*.*.*:
sourceType:
type: string
label: 'Group source type'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
......@@ -135,21 +135,27 @@ function testSchemaMapping() {
$expected['label'] = 'Image style';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['mapping']['name']['type'] = 'string';
$expected['mapping']['uuid']['label'] = 'UUID';
$expected['mapping']['id']['label'] = 'ID';
$expected['mapping']['id']['type'] = 'string';
$expected['mapping']['uuid']['type'] = 'string';
$expected['mapping']['uuid']['label'] = 'UUID';
$expected['mapping']['label']['type'] = 'label';
$expected['mapping']['label']['label'] = 'Label';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Default language';
$expected['mapping']['status']['type'] = 'boolean';
$expected['mapping']['status']['label'] = 'Status';
$expected['mapping']['dependencies']['type'] = 'config_dependencies';
$expected['mapping']['dependencies']['label'] = 'Dependencies';
$expected['mapping']['name']['type'] = 'string';
$expected['mapping']['effects']['type'] = 'sequence';
$expected['mapping']['effects']['sequence'][0]['type'] = 'mapping';
$expected['mapping']['effects']['sequence'][0]['mapping']['id']['type'] = 'string';
$expected['mapping']['effects']['sequence'][0]['mapping']['data']['type'] = 'image.effect.[%parent.id]';
$expected['mapping']['effects']['sequence'][0]['mapping']['weight']['type'] = 'integer';
$expected['mapping']['effects']['sequence'][0]['mapping']['uuid']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Default language';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['status']['label'] = 'Enabled';
$expected['mapping']['status']['type'] = 'boolean';
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.style.large');
$this->assertEqual($definition, $expected);
// More complex, type based on a complex one.
$definition = \Drupal::service('config.typed')->getDefinition('image.effect.image_scale');
......
......@@ -21,29 +21,14 @@ config_test.dynamic.*:
label: 'Protected property'
config_test_dynamic:
type: mapping
type: config_entity
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
weight:
type: integer
label: 'Weight'
style:
type: string
label: 'style'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
protected_property:
type: string
label: 'Protected property'
......
# Schema for the configuration files of the Contact module.
contact.category.*:
type: mapping
type: config_entity
label: 'Contact category'
mapping:
id:
type: string
label: 'Category identifier'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
recipients:
type: sequence
label: 'Recipients'
......@@ -25,12 +16,6 @@ contact.category.*:
weight:
type: integer
label: 'Weight'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
contact.settings:
type: mapping
......
# Schema for the configuration files of the Editor module.
editor.editor.*:
type: mapping
type: config_entity
label: 'Text editor'
mapping:
format:
......@@ -38,12 +38,3 @@ editor.editor.*:
height:
type: integer
label: 'Maximum height'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
......@@ -30,45 +30,21 @@ entity.view_mode.*.*:
label: 'Dependencies'
entity.form_mode.*.*:
type: mapping
type: config_entity
label: 'Entity form mode settings'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'The human-readable name of the form mode'
targetEntityType:
type: string
label: 'Target entity type'
status:
type: boolean
label: 'Enabled'
cache:
type: boolean
label: 'Cache'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Overview configuration information for view mode or form mode displays.
entity.view_display.*.*.*:
type: mapping
type: config_entity
label: 'Entity display'
mapping:
id:
type: string
label: 'Entity display ID'
uuid:
type: string
label: 'UUID'
targetEntityType:
type: string
label: 'Target entity type'
......@@ -78,9 +54,6 @@ entity.view_display.*.*.*:
mode:
type: string
label: 'View or form mode machine name'
status:
type: boolean
label: 'Enabled'
content:
type: sequence
label: 'Field display formatters'
......@@ -92,21 +65,12 @@ entity.view_display.*.*.*:
sequence:
- type: boolean
label: 'Value'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Overview configuration information for form mode displays.
entity.form_display.*.*.*:
type: mapping
type: config_entity
label: 'Entity form display'
mapping:
id:
type: string
label: 'Entity display ID'
uuid:
type: string
label: 'UUID'
targetEntityType:
type: string
label: 'Target entity type'
......@@ -121,12 +85,6 @@ entity.form_display.*.*.*:
label: 'Field form display formatters'
sequence:
- type: entity_form_display.field.[type]
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
hidden:
type: sequence
label: 'Hidden'
......
......@@ -9,21 +9,9 @@ field.settings:
label: 'Maximum number of field data records to purge'
field.field.*.*:
type: mapping
type: config_entity
label: 'Field'
mapping:
id:
type: string
label: 'Machine name'
uuid:
type: string
label: 'UUID'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
name:
type: string
label: 'Name'
......@@ -56,26 +44,11 @@ field.field.*.*:
sequence:
- type: string
label: 'Column'
dependencies:
type: config_dependencies
label: 'Dependencies'
field.instance.*.*.*:
type: mapping
type: config_entity
label: 'Field instance'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
field_uuid:
type: string
label: 'Field UUID'
......@@ -88,9 +61,6 @@ field.instance.*.*.*:
bundle:
type: string
label: 'Bundle'
label:
type: label
label: 'Label'
description:
type: text
label: 'Help text'
......@@ -107,9 +77,6 @@ field.instance.*.*.*:
field_type:
type: string
label: 'Field type'
dependencies:
type: config_dependencies
label: 'Dependencies'
entity_form_display.field.hidden:
type: entity_field_form_display_base
......
......@@ -12,21 +12,15 @@ filter.settings:
label: 'Always show fallback choice'
filter.format.*:
type: mapping
type: config_entity
label: 'Text formats'
mapping:
format:
type: string
label: 'Machine name'
name:
type: label
label: 'Name'
uuid:
format:
type: string
label: 'UUID'
status:
type: boolean
label: 'Enabled'
label: 'Machine name'
weight:
type: integer
label: 'Weight'
......@@ -44,9 +38,6 @@ filter.format.*:
label: 'Enabled filters'
sequence:
- type: filter
langcode:
type: string
label: 'Default language'
filter_settings.*:
type: sequence
......
# Schema for configuration files of the Image module.
image.style.*:
type: mapping
type: config_entity
label: 'Image style'
mapping:
name:
type: string
uuid:
type: string
label: 'UUID'
label:
type: label
effects:
type: sequence
sequence:
......@@ -24,12 +19,6 @@ image.style.*:
type: integer
uuid:
type: string
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Enabled'
image.effect.image_crop:
type: image_size
......
......@@ -79,18 +79,9 @@ language.mappings:
label: 'Language'
language.entity.*:
type: mapping
type: config_entity
label: 'Language'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Language name'
direction:
type: integer
label: 'Direction'
......@@ -100,12 +91,6 @@ language.entity.*:
locked:
type: boolean
label: 'Locked'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
language.settings:
type: mapping
......
......@@ -12,18 +12,15 @@ node.settings:
label: 'Use admin theme when editing or creating content'
node.type.*:
type: mapping
type: config_entity
label: 'Content type'
mapping:
type:
type: string
label: 'Machine-readable name'
uuid:
type: string
label: 'UUID'
name:
type: label
label: 'Name'
type:
type: string
label: 'Machine-readable name'
description:
type: text
label: 'Description'
......@@ -42,12 +39,6 @@ node.type.*:
mapping:
node:
type: node.settings.node
status:
type: boolean
label: 'Enabled status of the configuration entity'
langcode:
type: string
label: 'Default language'
node.settings.node:
type: mapping
......
# Schema for the configuration files of the RDF module.
rdf.mapping.*.*:
type: mapping
type: config_entity
label: 'RDF mapping'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
targetEntityType:
type: string
label: 'Target entity type'
......@@ -26,6 +20,3 @@ rdf.mapping.*.*:
label: 'Field mappings'
sequence:
- type: rdf_field_mapping
dependencies:
type: config_dependencies
label: 'Dependencies'
......@@ -65,24 +65,9 @@ search.settings:
label: 'Tag a weight'
search.page.*:
type: mapping
type: config_entity
label: 'Search page'
mapping:
id:
type: string
label: 'Machine-readable name'
label:
type: label
label: 'Label'
uuid:
type: string
label: 'UUID'
status:
type: boolean
label: 'Enabled status of the configuration entity'
langcode:
type: string
label: 'Default language'
path:
type: string
label: 'Search page path'
......@@ -94,6 +79,3 @@ search.page.*:
label: 'Plugin'
configuration:
type: search.plugin.[%parent.plugin]
dependencies:
type: config_dependencies
label: 'Dependencies'
# Schema for the configuration files of the Shortcut module.
shortcut.set.*:
type: mapping
type: config_entity
label: 'Shortcut settings'
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
langcode:
type: string
label: 'Default language'
links:
type: sequence
label: 'Shortcuts'
sequence:
- type: string
label: 'Shortcut'
status:
type: boolean
label: 'Status'
......@@ -115,21 +115,9 @@ system.date:
label: 'Remind users at login if their time zone is not set'
system.date_format.*:
type: mapping
type: config_entity
label: 'Date format'
mapping:
id:
type: string
label: 'Date format identifier'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Date format label'
status:
type: boolean
label: 'Enabled'
locked:
type: boolean
label: 'Locked'
......@@ -272,50 +260,20 @@ system.theme:
label: 'Default theme'
system.menu.*:
type: mapping
type: config_entity
label: 'Menu'
mapping:
id:
type: string
label: 'Menu identifier'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Menu label'
description:
type: label
label: 'Menu description'
langcode:
type: string
label: 'Default language'
locked:
type: boolean
label: ''
status:
type: boolean
label: ''
system.action.*:
type: mapping