mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-18 23:00:54 +00:00
* [Ruby] Test correct escaping of pattern sequences Ruby is not correctly escaping pattern sequences containing forward slashes in their definition. This commit adds tests that verify the correct behaviour of the code generator. See issue #5582. * [Ruby] Correctly escape patterns containing forward slashes Ruby regexs are always generated as match patterns enclosed in slash characters (i.e. using the `/pattern/` syntax). Regular expressions defined in the OpenAPI declaration via the `pattern` attribute follow [ECMA 262](https://262.ecma-international.org/5.1/#sec-15.10.1) which means they already include the correct escaping of forward slashes as far as Ruby is concerned. The current Ruby codegen is incorrectly escaping all forward slashes, which ultimately causes the generated code to include additional incorrect escape sequences which cause the generated file to have an invalid syntax. This commit ports the same fix introduced in #1539 for the Python codegen, as both Ruby and Python use perl-flavored regular expressions so they behave in the same way when it comes to escaping forward slashes. Fixes #5582.