Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern string sampler fails maxLength constraint when pattern contains nested unlimited quantifiers #246

Closed
ostridm opened this issue Aug 9, 2024 · 0 comments · Fixed by #247
Assignees
Labels
Type: bug Something isn't working.

Comments

@ostridm
Copy link
Contributor

ostridm commented Aug 9, 2024

Description

Pattern string sampler fails maxLength constraint when pattern contains nested unlimited quantifiers and produce an unexpected error

Steps to reproduce

Pass the schema to sample as follows:

sample({
  maxLength: 55,
  minLength: 0,
  format: 'pattern',
  pattern: '^[A-Za-z0-9._%-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{1,4}$',
  type: 'string'
});

Actual result

Error reported:

Sample string cannot be generated by boundaries: minLength=0, maxLength=55, format=pattern

Expected result

Sample value generated successfully

@ostridm ostridm added the Type: bug Something isn't working. label Aug 9, 2024
@ostridm ostridm self-assigned this Aug 9, 2024
ostridm added a commit that referenced this issue Aug 9, 2024
ostridm added a commit that referenced this issue Aug 9, 2024
ostridm added a commit that referenced this issue Aug 13, 2024
ostridm added a commit that referenced this issue Aug 13, 2024
ostridm added a commit that referenced this issue Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working.
Projects
None yet
1 participant