Skip to content

fix(ids): match patterns against the whole value and apply every length limit - #816

Open
helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/ids-pattern-length
Open

helenkwok wants to merge 1 commit into
ThatOpen:mainfrom
helenkwok:fix/ids-pattern-length

Conversation

@helenkwok

Copy link
Copy Markdown
Contributor

Description

Fixes #815.

  • pattern: the regular expression is wrapped as ^(?:…)$, so it matches the whole value as an XSD pattern does.
  • length: length, min and max must all hold, instead of the last one checked deciding.

Additional context

  • New facets/facet.test.ts tests evalRequirement through a minimal facet (no model needed): whole-value pattern matching, alternation (A|B rejects AB), and the combined length limits. Both tests fail without the change.
  • vitest --run in packages/core: all pass. tsc -p tsconfig-build.json --noEmit is clean.
  • XSD regular expressions have a few constructs JavaScript doesn't (\i, \c, character class subtraction). This PR doesn't translate those; it only fixes the anchoring.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Follow the Conventional Commits v1.0.0 standard for PR naming (e.g. feat(examples): add hello-world example).
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

This branch has not been deployed

No deployments
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.

IDS: pattern restrictions match substrings, and length limits overwrite each other

1 participant