Closed spacether closed 3 years ago
Hello @spacether .
At the moment flags are not supported.
The ignore_case (case insensitive generation) can be turned on using configuration object and this option.
The generated values are always multiline
- you can specify ^
and $
character to mark start/end of string and \n
or \r\n
or \r
of new line.
As for global
flag - I don't see how it fits in generation of text by pattern.
Please let me know if you want some specific behavior with/without global
flag.
In general I will implement parsing of the ECMA format and parsing flags, though as far as I see I will ignore g
and m
flags. And i
flag will set the parameter for case insensitive generation.
This will be done as part of #56 issue.
Please add details/examples if you expect some specific behavior (different behavior) for g
and m
flags or close the ticket if you agree with what I wrote above.
Thank you for explaining that. Glad to see that we can use the ignore_case option. I agree that global has no impact so it makes sense to omit it. It looks like when not in multiline mode then ^ will only match the beginning of the passed in string and $ will only match the end of the string. When in multiline mode ^ will additionally match right after all newlines and $ will additionally match right before newlines. Do you agree with that interpretation? Could a multiline True/False option be added to your Configuration?
Here is a sample of what could be generated with MULTILINE=True/False
pattern = '^a'
MULTILINE=False
MULTILINE=TRUE
Another issue is created for multiline generation - #58 . Case insensitive generation is supported by configuration option and will be supported with flags when #56 is done.
Thank you!
Is your feature request related to a problem? Please describe. Are regex flags supported? I would like them to be used when generating samples.
Per:
Describe the solution you'd like One where we can pass in the flags in the regex input string.
Describe alternatives you've considered N/A
Additional context This came up when reviewing https://github.com/OpenAPITools/openapi-generator/pull/8054#pullrequestreview-555587102