From 4b97af5e87ee16283243a2638f9417f9c36f9ea6 Mon Sep 17 00:00:00 2001 From: Antonio De Marco <antonio@nuvole.org> Date: Fri, 20 Apr 2018 20:14:26 +0200 Subject: [PATCH] Issue #181: Make fields not required anymore. --- src/TypedData/PatternDataDefinition.php | 2 +- tests/features/overview.feature | 2 -- tests/src/fixtures/validation.yml | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/TypedData/PatternDataDefinition.php b/src/TypedData/PatternDataDefinition.php index a0e89b90..93f17892 100644 --- a/src/TypedData/PatternDataDefinition.php +++ b/src/TypedData/PatternDataDefinition.php @@ -42,7 +42,7 @@ class PatternDataDefinition extends MapDataDefinition { ->setPropertyDefinition('base path', DataDefinition::create('string')->setRequired(TRUE)) ->setPropertyDefinition('file name', DataDefinition::create('string')->setRequired(TRUE)) ->setPropertyDefinition('provider', DataDefinition::create('string')->setRequired(TRUE)) - ->setPropertyDefinition('fields', $this->getFieldsDefinition()->setRequired(TRUE)) + ->setPropertyDefinition('fields', $this->getFieldsDefinition()) ->setPropertyDefinition('theme hook', DataDefinition::create('string')->setRequired(TRUE)) ->setPropertyDefinition('description', DataDefinition::create('string')) ->setPropertyDefinition('use', DataDefinition::create('string')) diff --git a/tests/features/overview.feature b/tests/features/overview.feature index 3f5a74ac..fd4354f3 100644 --- a/tests/features/overview.feature +++ b/tests/features/overview.feature @@ -81,11 +81,9 @@ Feature: Overview | error messages | | Pattern 'bad_pattern' is skipped because of the following validation error(s): | | Validation error on "bad_pattern.label": This value should not be null. | - | Validation error on "bad_pattern.fields": This value should not be null. | And I reload the page Then I should not see the following error messages: | error messages | | Pattern 'bad_pattern' is skipped because of the following validation error(s): | | Validation error on "bad_pattern.label": This value should not be null. | - | Validation error on "bad_pattern.fields": This value should not be null. | diff --git a/tests/src/fixtures/validation.yml b/tests/src/fixtures/validation.yml index 4ae35e26..8507a14c 100644 --- a/tests/src/fixtures/validation.yml +++ b/tests/src/fixtures/validation.yml @@ -7,7 +7,6 @@ - "base path: This value should not be null." - "file name: This value should not be null." - "provider: This value should not be null." - - "fields: This value should not be null." - "theme hook: This value should not be null." - pattern: @@ -18,7 +17,6 @@ - "base path: This value should not be null." - "file name: This value should not be null." - "provider: This value should not be null." - - "fields: This value should not be null." - "theme hook: This value should not be null." - pattern: @@ -26,12 +24,14 @@ label: label description: description fields: - not valid name: + fass: + name: 'not valid name' messages: - "base path: This value should not be null." - "file name: This value should not be null." - "provider: This value should not be null." - - "fields: This value should not be null." + - "fields.0.name: This value is not valid." + - "fields.0.label: This value should not be null." - "theme hook: This value should not be null." - pattern: -- GitLab