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

stringMock doesn't limit maxLength #59

Open
achinmay opened this issue Dec 28, 2018 · 0 comments
Open

stringMock doesn't limit maxLength #59

achinmay opened this issue Dec 28, 2018 · 0 comments

Comments

@achinmay
Copy link

achinmay commented Dec 28, 2018

If any of the parameter or object properties of type string has maxLength = 2GB, mock will try to create a large string. There should be a limit on the size of the string being generated. For example:

"account_note": { "type": "string", "maxLength": 2147483647, "example": "" }

SwagMock will try to call Chance.string({ length:2147483647, alpha:true }) which results in a very large alpha string getting created. I provided a workaround by adding following patch:

174a175,179
> if(maxLength > 4096)
> {
> maxLength = 4096;
> }

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

No branches or pull requests

1 participant