-
Notifications
You must be signed in to change notification settings - Fork 13
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 [0-9,\s]{5} generates whitespace symbols that user probably didn't expect - make configurable? #77
Comments
Hello! Just out of curiosity - if you say that this pattern gives you unexpected characters, why don't you use a pattern that would produce only expected values? |
Hey there. The schemas (WSDLs) I receive are not mine. Those are from external teams. My goal is to generate reasonable mock payloads for the requests and responses - I maintain a mock service, https://mockmotor.com . So when the external schema contains types like
They don't expect to see new lines in the generated values, let alone the tabs and LF. In fact, when a value can include a multiline value or a general text, they just use type xs:string. The very fact of using a pattern signals to me that the value is very likely a single-line value. |
Hello! Thank you for the explanation. I'll implement the requested change. |
…ework #77.wnitespace generation rework
Hello @mockmotor ! This is now implemented as part of 2.0 release.
|
Excellent, thanks! I will test it for the next week's build! |
A simple pattern [0-9,\s]{5} generates strings like (in hex):
0035 0031 0020 000d 000c
0009 0035 000c 0035 0035
I.e. using CR and LF and also symbols such as FF (form feed) and TAB.
Formally, it is correct - those control characters match the \s format.
However, in practice, users only think of spaces and maybe tabs when using the \s format.
It would be convenient to make this behaviour configurable via options.
I propose three options:
In my code, I manually replace the whitespace characters with spaces. It is a workaround, but a bit ugly :)
The text was updated successfully, but these errors were encountered: