Skip to content

feat(concerto-cto): allow validators in any order in field declarations - #1305

Merged
mttrbrts merged 7 commits into
accordproject:mainfrom
muhabdulkadir:moh/fix-cto-order
Aug 28, 2026
Merged

mttrbrts merged 7 commits into
accordproject:mainfrom
muhabdulkadir:moh/fix-cto-order

Conversation

@muhabdulkadir

@muhabdulkadir muhabdulkadir commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #

Validators (regex, length, range, size) are no longer positionally fixed in the PEG grammar; they can appear in any order between default and optional

  • Previously, o String x length=[1,10] regex=/abc/ would fail to parse because regex had to come before length
  • Adds per-type *Validators collection rules that match any valid validator for the field type in any order and bucket them by $class

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@muhabdulkadir muhabdulkadir changed the title moh/fix cto order feat(concerto-cto): allow validators in any order in field declarations Aug 28, 2026

@mttrbrts mttrbrts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, thanks Muh. Can you patch up the PR title, and check that the old issue is closed?

@mttrbrts
mttrbrts merged commit 8a4460d into accordproject:main Aug 28, 2026
12 checks passed
@muhabdulkadir
muhabdulkadir deleted the moh/fix-cto-order branch August 28, 2026 11:43
mttrbrts pushed a commit that referenced this pull request Sep 3, 2026
…eping the last (#1314)

The any-order validator collection introduced in #1305 buckets validators
by $class with plain assignment, so regex=/a/ regex=/b/ now parses and
silently drops /a/. The same applies to length, range and size, on both
fields and scalars; before #1305 the grammar rejected all of these. A
modeler's constraint being silently discarded weakens validation.

The grammar initializer gains a bucketValidators helper that raises a
located 'Duplicate <kind> validator' error on a repeat, used by all five
reducer rules. src/parser.js regenerated with npm run parser, matching the
convention of committing the generated parser.

Seven tests added covering duplicate regex, length, range (Integer, Double,
Long) and size on fields plus regex on a scalar; all fail on the unfixed
grammar and every any-order valid case from #1305 still parses.

Signed-off-by: rajanpanth <rajan.pantha@samriddhicollege.edu.np>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants