-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[BUG] Generated Ruby client contains syntax errors when pattern of properties includes single-quote #2069
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Thanks for reporting the issue. Your suggestion sounds good to me. |
Thank you for checking. I will create a PR to resolve this with #2081 together. |
* master: (40 commits) [Python] remove default value from being fallback to example (#2213) Add petstore integration tests to Ruby OAS3 client (#2211) Gradle - make GenerateTask properties optional (#2185) skip bats installation (#2198) Something in the dependencies changed. This switch is no longer needed. (#1850) Use oauth token for basic bearer auth in Rust. (#2161) Fix missing nullable (#2189) Enable error handling in Java WebClient library, fixes #1243 (#1244) [core] fix referenced enum case (#2175) rest-template: allow array parameters in path using collectionFormat (#2177) update go petstore samples Fix string types for cpprestsdk client generator (#1676) update kotline samples Remove API Key Authentication code for go when cookie is used. (#1601) changed the package install instructions to install the .tgz package … (#1989) okhttp-gson: allow array parameters in path using collectionFormat (#2137) [Ruby] Fix regualr expression in error message (#2069) (#2139) [kotlin][client] bytearray conversion (#2166) [rust-server] Added client documentation to rust-server (#2159) [Java] Getter/Setter naming convention not followed in generated models (#2095) ...
…penAPITools#2139) * Fix usage of regular expression literals in Ruby client (OpenAPITools#2069) * update samples of Ruby client (OpenAPITools#2069)
Bug Report Checklist
Description
When
pattern
includes odd number of single quotes, the generated Ruby client code contains syntax errors.openapi-generator version
OpenAPI declaration file content or url
See: https://gist.github.com/autopp/e707d5d2ec36f7cfe6a3950d76d54b6f#file-swagger-yml
The point to notice in this example is that
'
is included in the pattern constraint of the propertyy
of the modelx
.Command line used for generation
Steps to reproduce
ruby -c /tmp/gem/lib/openapi_client/models/x.rb
to check syntax of the generated model code.lib/openapi_client/models/x.rb
:Related issues/PRs
#2067
Suggest a fix
escapeText
ofRubyClientCodegen
seems to escape for double-quote string literals only. However, the corresponding template uses a single quote string.I think it is difficult for the generator to determine whether the expansion destination is a single-quote string or a double-quote string. Instead, I think that it is better to unify it with a double-quote string in the template.
The text was updated successfully, but these errors were encountered: