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

[BUG][Ruby][Faraday] Request options of build_request is empty #10137

Closed
4 of 6 tasks
NivathaSV8 opened this issue Aug 12, 2021 · 5 comments
Closed
4 of 6 tasks

[BUG][Ruby][Faraday] Request options of build_request is empty #10137

NivathaSV8 opened this issue Aug 12, 2021 · 5 comments

Comments

@NivathaSV8
Copy link
Contributor

NivathaSV8 commented Aug 12, 2021

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
openapi-generator version

openapi-generator-cli:v5.1.1

OpenAPI declaration file content or url
openapi: 3.0.3

info:
  title: 'Some title'
  version: '1.0'
  
servers:
  - url: 'https://localhost/api/v1'
        
paths:
  /customer:
    post:
      operationId: Post Customer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                accounts:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        default: 'someone'
                      age:
                        type: integer
                        default: 18
      responses:
        '200':
          description: 'OK'
Steps to reproduce

Using the client and hit API as follows:

TestClient.configure do |config|
  config.scheme = 'localhost.com:4000'
  config.host = 'http'
  config.base_path = '/'
  config.debugging = true
  config.server_index = nil
  config.timeout = 120
end
Actual Ouput:

#<struct Faraday::Request method=:post, path="http://localhost.com:4000/api/v1/customer", params={}, headers={"Content-Type"=>"application/json", "User-Agent"=>"OpenAPI-Generator/1.0.0/ruby", "Accept"=>"application/json"}, body="{"name":"Test","age":"18"}", options=#<Faraday::RequestOptions (empty)>>

Expected Output:

Faraday Request Options contains timeout set as mentioned above.

Related issues/PRs

N/A

Suggest a fix

-req_opts.update :body => req_body

request.headers = header_params
request.body = req_body
request.url url
request.params = query_params
+request.options = req_opts
download_file(request) if opts[:return_type] == 'File'

@wing328
Copy link
Member

wing328 commented Aug 13, 2021

Can you please file a PR with the suggested fix?

@NivathaSV8
Copy link
Contributor Author

NivathaSV8 commented Aug 18, 2021

@wing328 I have created a PR with required changes. But I am sorry the CI actions have failed.
So can this issue be fixed based on the commits.

#10180

@NivathaSV8
Copy link
Contributor Author

@wing328 Can this PR be updated and merged since its a blocker in using the API in production.
Or can you please suggest a solution to fix the error in CI actions and get it merged.

@NivathaSV8
Copy link
Contributor Author

@cliffano @zlx @autopp Can someone please have a look on this issue and get it fixed.

@NivathaSV8
Copy link
Contributor Author

@dkliban I could see similar change has been done by you, so can you please have a look on the commits and have this issue fixed.

wing328 pushed a commit that referenced this issue Oct 2, 2021
* Update default timeout of Faraday request to 60 seconds

* Fix request options of Ruby Faraday client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants