Problem/Motivation

In RHDC, a migration from D7 to D9 may have introduced data into some patterns that don't match the schema. This seems to cause patternkit to omit validation checks when a required field in a schema isn't filled out.
This test is to validate that required fields within a schema are properly validated in patternkit.

Steps to reproduce

Pre-requisite
  • Add "required": ["text"] in the schema file to make that particular field mandatory/required.
  1. Enable Patternkit and Patternkit example module.
  2. Configure a node type and enable layout builder.
  3. Add a new content with layout builder enabled and fill out the required field.
  4. Go to layout builder tab.
  5. Add [Patternkit] Example block
  6. Don't give any input in the text field which is required
  7. Click on add/save block

Success Criteria

  • On save, any required fields on a pattern are filled out
  • If any data in the pattern doesn't match the schema
  • Fail validation and provide opportunity for the editor to fix
  • Display validation failure information to guide the editor
  • Don't allow submission of the form

API changes

N/A

Data model changes

N/A

Issue fork patternkit-3453875

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

minsharm created an issue. See original summary.

minsharm’s picture

Issue summary: View changes
minsharm’s picture

Issue summary: View changes

slucero made their first commit to this issue’s fork.

slucero’s picture

I've added a new merge request branch, 3453875--submission-validation, that aims to fix and enable submission validation from JSON Editor forms when creating or editing a pattern block. When an invalid value is provided, client-side validation should show a warning for the related field, and if any validation would fail when the form is submitted, the form should be re-displayed to the user with a validation failure message and appropriate feedback.

slucero’s picture

Status: Active » Needs review
minsharm’s picture

I have tested this issue on both D10 and D11 and result looks good to me.

slucero changed the visibility of the branch 3453875-test-validation-of to hidden.

slucero changed the visibility of the branch 9.1.x to hidden.

slucero’s picture

Status: Needs review » Reviewed & tested by the community
Parent issue: » #3542304: Patternkit 9.1.3 Release Plan

  • slucero committed e3a2c1dd on 9.1.x
    [#3453875] feat: Test Validation of Required Fields within Schema
    
    By:...
slucero’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Merged for inclusion in the 9.1.3 release. See #3542304: Patternkit 9.1.3 Release Plan.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.