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

[Feature]Enable faker.helpers.fromRegExp() to be applied to msw mock from pattern keyword #1396

Closed
mmrakt opened this issue May 23, 2024 · 0 comments · Fixed by #1398
Closed
Labels
enhancement New feature or request mock Related to mock generation

Comments

@mmrakt
Copy link

mmrakt commented May 23, 2024

What are the steps to reproduce this issue?

I would like to be able to apply faker.helpers.fromRegExp() to msw mock from a patternkeyword.

e.g.

schemas:
  userId:
    description: user ID
    type: string
    pattern: '^[0-9a-f]{8}-[0-9a-f]{4}$'
    example: '1579f37a-a3e1-201d'
 userName:
    description: user name
    type: string
    example: 'john doe' 

The current situation is converted as follows.

uesrId: faker.word.sample(),
uesrName: faker.word.sample()

I want it converted as follows.

userId: faker.helpers.fromRegExp(/[0-9a-f]{8}-[0-9a-f]{4}/), // e43d7650-d266
uesrName: faker.word.sample()

Or if you have an alternative, I'd love to hear about it!

What happens?

Any other comments?

What versions are you using?

Operating System:
Package Version:
Browser Version:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants