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

mock strings fields as 20 char strings #1686

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

borisyordanov
Copy link
Contributor

@borisyordanov borisyordanov commented Nov 1, 2024

Status

READY

Description

With faker.string.alpha(20), you get a 20-character string using random letters from the alphabet. The chances of getting an identical string are astronomically low, given the vast number of possible combinations.

On the other hand, faker.word.sample() picks a word from a predefined list of words. The uniqueness of this function is limited to the size of that list. So, while it’s great for generating realistic and coherent words, it doesn’t offer the same level of uniqueness as generating a random string of 20 characters.

In summary:

faker.string.alpha(20): Super unique because of the high number of possible combinations.

faker.word.sample(): Limited uniqueness, depending on the list size. Ideal if you want sensible words rather than random strings.

Resolves #1680

Related PRs

List related PRs against other branches:

branch PR
other_pr_production link
other_pr_master link

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

> git pull --prune
> git checkout <branch>
> grunt jasmine

@borisyordanov borisyordanov marked this pull request as ready for review November 1, 2024 07:56
@melloware melloware added the mock Related to mock generation label Nov 1, 2024
@melloware melloware merged commit 1852bae into orval-labs:master Nov 1, 2024
2 checks passed
@borisyordanov borisyordanov deleted the unique-mock branch November 1, 2024 12:33
@soartec-lab soartec-lab mentioned this pull request Nov 9, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock Related to mock generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mocked responses aren't unique
2 participants