Skip to content
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

[RUBY] Stop using deprecated URI.encode #10444

Closed
kitop opened this issue Sep 1, 2020 · 1 comment
Closed

[RUBY] Stop using deprecated URI.encode #10444

kitop opened this issue Sep 1, 2020 · 1 comment

Comments

@kitop
Copy link
Contributor

kitop commented Sep 1, 2020

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.

@kitop
Copy link
Contributor Author

kitop commented Sep 2, 2020

Closed via #10445

@kitop kitop closed this as completed Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant