Skip to content
Snippets Groups Projects

Resolve #3500997 "Move sdc specific validation"

5 unresolved threads

Closes #3500997

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Wim Leers
  • Wim Leers added 1 commit

    added 1 commit

    Compare with previous version

  • Nice one, will try to get this green today

  • Lee Rowlands added 1 commit

    added 1 commit

    Compare with previous version

  • Lee Rowlands resolved all threads

    resolved all threads

  • Lee Rowlands added 1 commit

    added 1 commit

    Compare with previous version

  • Lee Rowlands added 1 commit

    added 1 commit

    • 9d4fa177 - Move SDC validation handling to plugin

    Compare with previous version

  • Lee Rowlands added 1 commit

    added 1 commit

    Compare with previous version

  • Lee Rowlands added 1 commit

    added 1 commit

    • eb4466f5 - Return violation constraint instead

    Compare with previous version

  • Lee Rowlands
  • Lee Rowlands added 2 commits

    added 2 commits

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • 1a905ea1 - AFAICT one `catch` is unnecessary, because it is caught earlier?

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • b9d621c6 - `::validateComponentInput()` must return validation errors in the server-side data model.

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • a7610a25 - Catch the `SDC`-specific exception and the `DynamicPropSource`-specific...

    Compare with previous version

  • Wim Leers
  • Wim Leers
  • Wim Leers
  • Wim Leers
  • Wim Leers
  • Wim Leers
  • Wim Leers
    Wim Leers @wimleers started a thread on the diff
  • 140 143 $this->assertConvert(
    141 144 $invalid_heading_client_json,
    142 145 ['model.' . self::TEST_HEADING_UUID . '.style' => 'Does not have a value in the enumeration ["primary","secondary"]'],
    143 'The updated title.',
    146 // The error above happens in `\Drupal\experience_builder\Controller\ClientServerConversionTrait::convertClientToServer()`
    147 // therefore the title, as well as other entity fields will not be updated.
    148 'The original title.',
    144 149 );
  • Wim Leers
    Wim Leers @wimleers started a thread on the diff
  • 83 83 'expression' => 'ℹ︎string␟value',
    84 84 ],
    85 85 ],
    86 'component-block' => [],
    86 'component-block' => [
    87 'use_site_logo' => TRUE,
    88 'use_site_name' => TRUE,
    89 'use_site_slogan' => TRUE,
    90 'label_display' => FALSE,
    91 'label' => '',
    92 ],
    • Comment on lines -86 to +92
      Author Maintainer

      :information_source: This is now fixed throughout the XB codebase: wherever component trees are used, regardless of whether that's a config-defined component tree or not. That's why it was so very important to fix the XB-wide component tree validator to not only validate SDC-sourced Components in the tree, but also Block-sourced ones.

      :partying_face:

    • Please register or sign in to reply
  • Wim Leers
    Wim Leers @wimleers started a thread on the diff
  • 65 65 array_push($test_cases['missing components, using dynamic props'], SchemaIncompleteException::class, 'Schema errors for field.field.node.article.field_xb_test with the following errors: 0 [default_value.0] The 'dynamic' prop source type must be absent., 1 [default_value.0.tree[a548b48d-58a8-4077-aa04-da9405a6f418][0]] The component <em class="placeholder">sdc.sdc_test.missing</em> does not exist., 2 [default_value.0.tree[a548b48d-58a8-4077-aa04-da9405a6f418][1]] The component <em class="placeholder">sdc.sdc_test.missing-also</em> does not exist.');
    66 66 array_push($test_cases['props invalid, using dynamic props'], SchemaIncompleteException::class, 'Schema errors for field.field.node.article.field_xb_test with the following errors: 0 [default_value.0] The 'dynamic' prop source type must be absent.');
    67 67 array_push($test_cases['missing components, using only static props'], SchemaIncompleteException::class, 'Schema errors for field.field.node.article.field_xb_test with the following errors: 0 [default_value.0.tree[a548b48d-58a8-4077-aa04-da9405a6f418][0]] The component <em class="placeholder">sdc.sdc_test.missing</em> does not exist.');
    68 array_push($test_cases['props invalid, using only static props'], SchemaIncompleteException::class, 'Schema errors for field.field.node.article.field_xb_test with the following errors: 0 [default_value.0] The component instance with UUID <em class="placeholder">static-card2df</em> uses component <em class="placeholder">sdc.xb_test_sdc.props-no-slots</em> and receives some invalid props! Put a breakpoint here and figure out why.');
    • Author Maintainer

      :thinking: Why this change?!

      HAH! IT was a duplicate; the same addition already exists a few lines higher, and this was simply an ignored value at the very end of the arguments array for this test case :see_no_evil:

      (I never liked this structure; it's overdue for a refactor. Thanks for catching this. :thumbsup:)

    • Please register or sign in to reply
  • Wim Leers
  • Wim Leers
  • Author Maintainer

    FYI: ~150 of the "net new" lines is updating invalid tests to provide the inputs that Block-sourced Components need!

    That makes this MR seem artificially larger than it is.

    It also fixed a number of bugs in HEAD, by making the most important validator that XB have explicit support for ComponentSource plugins, rather than hard-coding SDC-style validation.

  • Wim Leers added 2 commits

    added 2 commits

    • a39f9936 - The two `catch`es that have been moved need early returns in their new location.
    • 0a565a7d - Tweak `PatternValidationTest` invalid test case expectations for Drupal 10.

    Compare with previous version

  • Wim Leers added 2 commits

    added 2 commits

    • 33231921 - `phpstan`
    • 665136a6 - Rename `RenameConstraintPropertyPathTrait` to...

    Compare with previous version

  • Wim Leers
  • Wim Leers added 1 commit
  • merged

  • Dave Long
    Dave Long @longwave started a thread on the diff
  • 589 669 /**
    590 670 * {@inheritdoc}
    591 671 */
    592 public function clientModelToInput(string $component_instance_uuid, ComponentEntity $component, array $client_model): array {
    672 public function clientModelToInput(string $component_instance_uuid, ComponentEntity $component, array $client_model, ConstraintViolationListInterface $violations): array {
  • Dave Long
    Dave Long @longwave started a thread on the diff
  • 296 300 /**
    297 301 * {@inheritdoc}
    298 302 */
    299 public function validateComponentInput(array $inputValues, string $component_instance_uuid, ?FieldableEntityInterface $entity): void {
    300 // @todo Implement this in https://drupal.org/i/3500997, which will also allow refactoring ::clientModelToInput() to call this.
    303 public function validateComponentInput(array $inputValues, string $component_instance_uuid, ?FieldableEntityInterface $entity): ConstraintViolationListInterface {
    Please register or sign in to reply
    Loading