Skip to content
Snippets Groups Projects

Issue #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints

Open Issue #3324140: Convert field_storage_config and field_config's form validation logic to validation constraints
Compare and
37 files
+ 1224
53
Compare changes
  • Side-by-side
  • Inline
Files
37
@@ -533,16 +533,29 @@ base_entity_reference_field_settings:
field_config_base:
type: config_entity
constraints:
UniqueFieldCombination: [entity_type, bundle, field_name]
mapping:
id:
type: string
label: 'ID'
constraints:
StringParts:
separator: .
parts:
- '%parent.entity_type'
- '%parent.bundle'
- '%parent.field_name'
field_name:
type: string
label: 'Field name'
entity_type:
type: string
label: 'Entity type'
constraints:
PluginExists:
manager: entity_type.manager
interface: \Drupal\Core\Entity\FieldableEntityInterface
bundle:
type: string
label: 'Bundle'
@@ -554,6 +567,7 @@ field_config_base:
description:
type: text
label: 'Help text'
nullable: true
required:
type: boolean
label: 'Required field'
@@ -563,14 +577,29 @@ field_config_base:
default_value:
type: sequence
label: 'Default values'
nullable: true
sequence:
type: field.value.[%parent.%parent.field_type]
label: 'Default value'
constraint:
# TBD, looks like \Symfony\Component\Validator\Constraints\ValidValidator *could* work here…
Valid: []
default_value_callback:
type: string
label: 'Default value callback'
nullable: true
constraints:
Type:
type:
- 'callable'
- 'string'
- 'null'
settings:
type: field.field_settings.[%parent.field_type]
# @todo Constraints on each of the field type-specific settings config
# schemas BUT extra special challenge: until Drupal 11, at best only
# core field types will have validation constraints set! Remove this
# todo in https://drupal.org/i/3512957
field_type:
type: string
label: 'Field type'
@@ -582,6 +611,8 @@ field_config_base:
core.base_field_override.*.*.*:
type: field_config_base
label: 'Base field bundle override'
constraints:
FullyValidatable: ~
core.date_format.*:
type: config_entity
@@ -666,6 +697,12 @@ field.storage_settings.string:
type: boolean
label: 'Contains US ASCII characters only'
field.field_settings.string:
type: mapping
label: 'String settings'
constraints:
FullyValidatable: ~
field.value.string:
type: mapping
label: 'Default value'
@@ -683,6 +720,14 @@ field.storage_settings.string_long:
case_sensitive:
type: boolean
label: 'Case sensitive'
constraints:
FullyValidatable: ~
field.field_settings.string_long:
type: mapping
label: 'String (long) settings'
constraints:
FullyValidatable: ~
field.value.string_long:
type: mapping
@@ -698,6 +743,14 @@ field.value.string_long:
field.storage_settings.password:
type: field.storage_settings.string
label: 'Password settings'
constraints:
FullyValidatable: ~
field.field_settings.password:
type: mapping
label: 'Password settings'
constraints:
FullyValidatable: ~
# Schema for the configuration of the URI field type.
# This field type has no field instance settings, so no specific config schema type.
@@ -713,6 +766,12 @@ field.storage_settings.uri:
type: boolean
label: 'Case sensitive'
field.field_settings.uri:
type: mapping
label: 'URI settings'
constraints:
FullyValidatable: ~
field.value.uri:
type: mapping
label: 'Default value'
@@ -722,10 +781,19 @@ field.value.uri:
label: 'Value'
# Schema for the configuration of the Created field type.
# This field type has no field storage settings, so no specific config schema type.
# @see `type: field.storage_settings.*`
# This field type has no field instance settings, so no specific config schema type.
# @see `type: field.field_settings.*`
field.storage_settings.created:
type: mapping
label: 'Created timestamp settings'
constraints:
FullyValidatable: ~
field.field_settings.created:
type: mapping
label: 'Created timestamp settings'
constraints:
FullyValidatable: ~
field.value.created:
type: mapping
label: 'Default value'
@@ -735,10 +803,19 @@ field.value.created:
label: 'Value'
# Schema for the configuration of the Changed field type.
# This field type has no field storage settings, so no specific config schema type.
# @see `type: field.storage_settings.*`
# This field type has no field instance settings, so no specific config schema type.
# @see `type: field.field_settings.*`
field.storage_settings.changed:
type: mapping
label: 'Changed timestamp settings'
constraints:
FullyValidatable: ~
field.field_settings.changed:
type: mapping
label: 'Changed timestamp settings'
constraints:
FullyValidatable: ~
field.value.changed:
type: mapping
label: 'Default value'
@@ -756,6 +833,9 @@ field.storage_settings.entity_reference:
target_type:
type: string
label: 'Type of item to reference'
constraints:
PluginExists:
manager: entity_type.manager
field.field_settings.entity_reference:
type: mapping
@@ -797,6 +877,8 @@ field.field_settings.boolean:
off_label:
type: required_label
label: 'Off label'
constraints:
FullyValidatable: ~
field.value.boolean:
type: mapping
@@ -806,8 +888,13 @@ field.value.boolean:
label: 'Value'
# Schema for the configuration of the Email field type.
# This field type has no field storage settings, so no specific config schema type.
# @see `type: field.storage_settings.*`
field.storage_settings.email:
type: mapping
label: 'Email settings'
constraints:
FullyValidatable: ~
field.field_settings.email:
type: mapping
label: 'Email settings'
@@ -904,6 +991,8 @@ field.value.decimal:
field.storage_settings.float:
type: mapping
label: 'Float settings'
constraints:
FullyValidatable: ~
field.field_settings.float:
type: mapping
Loading