-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
Ruby's URI.encode has been deprecated over 10 years ago. In addition, Ruby 2.7 now shows the warning in non-verbose mode, resulting in very noisy logs.
Swagger-codegen version
2.4.15, and previous
Swagger declaration file content or url
N/A
Command line used for generation
./run-in-docker.sh /gen/bin/ruby-petstore.sh
Steps to reproduce
Generate the Ruby code, see URI.escape used in api_client.rb and configuration.rb files
Related issues/PRs
Couldn't find.
Suggest a fix/enhancement
URI.encode is a very simplistic percent-encoding replacement. This is not always correct, as it may vary on differenet parts of the URI.
We could copy the code from URI.escape to a Utils module, or inline it in each class, but we would still be doing a non-optimal encoding.
Another solution is to add a dependency on the addressable gem, and use Addressable::URI.encode which is part-aware. It adds one small dependency, but the escaping would be much better. That gem is also used by a lot of other gems, so might not be a big impact in the end user application.