Generated with the help of an LLM.

ChatGPT helped draft this issue summary.

Problem/Motivation

Follow-up to #3627330: Validation constraints do not contribute to the JSON Schema, requested by mglaman during review of MR !18061.

Count constraints limit the number of list elements. These limits should contribute minItems and maxItems to the list's JSON Schema.

This depends on the constraint interface from #3627330: Validation constraints do not contribute to the JSON Schema and list-schema support from #3627328: ListNormalizer does not provide a JSON Schema for lists.

Steps to reproduce

  1. Use a checkout with list-schema support from #3627328: ListNormalizer does not provide a JSON Schema for lists.
  2. Create a list definition with a Count constraint specifying min: 2 and max: 5.
  3. Generate its JSON Schema and check whether those limits appear on the array schema.

Proposed resolution

Implement the interface established in #3627330: Validation constraints do not contribute to the JSON Schema on CountConstraint. Apply representable count limits to the array schema, preserving its item schema and existing restrictions.

Read constraints from the list definition. Unsupported options must not produce restrictions that reject values accepted by Drupal.

Remaining tasks

User interface changes

None.

Introduced terminology

None.

API changes

CountConstraint would implement the interface established in #3627330: Validation constraints do not contribute to the JSON Schema.

Data model changes

None.

Release notes snippet

To be determined.

Issue fork drupal-3643476

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

mukesh-kumar3 created an issue. See original summary.

wkr1shna’s picture

Assigned: Unassigned » wkr1shna

mukesh-kumar3’s picture

The previously failing functional test job passed on retry without code changes.

wkr1shna’s picture

Thanks for confirming!

Good to know the previously failing Functional JavaScript job passed on retry without any code changes.

The implementation is available in [MR !18104](https://git.drupalcode.org/project/drupal/-/merge_requests/18104), with the prerequisite dependency work included.

Since the two prerequisite contributions are still under review, would you recommend keeping this MR in Draft for now, or moving it out of Draft so the implementation can receive feedback in parallel?

I'm happy to follow whichever approach is preferred.

dries’s picture

Issue tags: +rosetta