OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Ruby] Client does not form-encode PUT requests
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
The Ruby client relies on Typhoeus to make http requests. Due to typhoeus/typhoeus#389 the generated Ruby client does not form encode PUT requests even when the Content-Type is supposed to be 'multipart/form-data'. POST requests are form-encoded just fine.
openapi-generator version
latest master branch
OpenAPI declaration file content or url
https://docs.pulpproject.org/en/3.0/nightly/api.json
Command line used for generation
docker run -u $(id -u) --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/api.json \
-g ruby \
-o /local/pulpcore-client \
-DgemName=pulpcore_client \
-DgemLicense="GPLv2" \
-DgemVersion=3.0.0rc2 \
--skip-validate-spec \
--strict-spec=false
Steps to reproduce
require 'pulpcore_client'
PulpcoreClient.configure do |config|
config.host= "http://localhost:24817"
config.username= 'admin'
config.password= 'admin'
end
api_instance = PulpcoreClient::UploadsApi.new
content_range = "bytes 0-2373/2373" # String | The Content-Range header specifies the location of the file chunk within the file.
file = File.new('katello.gemspec') # File | A chunk of a file to upload.
begin
#Start Upload
result = api_instance.uploads_create(content_range, file)
p result
rescue PulpcoreClient::ApiError => e
puts "Exception when calling UploadsApi->uploads_create: #{e}"
end
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/7889
https://github.com/typhoeus/typhoeus/issues/389
Suggest a fix
Add ability to use a different library to perform requests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the generated Ruby client request using the provided Docker generation command and the UploadsApi example. Read the Ruby client request path and the linked Typhoeus issue first; done means multipart/form-data PUT requests are form-encoded correctly without breaking the existing POST behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100