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

Use reggen instead of faker.Regexify #56

Merged
merged 2 commits into from
Jun 22, 2021
Merged

Conversation

exgphe
Copy link
Contributor

@exgphe exgphe commented Jun 4, 2021

reggen generates string by regex of a better quality.
Take a regex of IPv4 for example.

faker.Regexify("^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\\p{N}\\p{L}]+)?$")

could produce "(8\.)))62"

while

reggen.Generate("^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\\p{N}\\p{L}]+)?$", 15)

produces "72.65.44.117".

@strider2038
Copy link
Collaborator

@exgphe Hello! Thank you for the pull request. There are some failing tests. Can you fix it?

https://scrutinizer-ci.com/g/muonsoft/openapi-mock/inspections/6bf14f63-82ff-43b9-ac70-56262fffbfaa

@exgphe
Copy link
Contributor Author

exgphe commented Jun 18, 2021

According to OAI/OpenAPI-Specification#1985 the pattern field should not include the wrapping slashes, so I modified the test function.

@strider2038 strider2038 merged commit b7fc029 into muonsoft:master Jun 22, 2021
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.

2 participants