Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #686
Closed
Open
Issue created Jul 30, 2018 by Administrator@rootContributor

[ruby/typescript-angular] Configure Accept header

Created by: davidvanlaatum

Description

There appears to be no way of specifying what format you want a response in for endpoints that can return multiple.

eg in the generated ruby code (also looks to me like the opts argument is never used)

    def get_domain_by_name_with_http_info(domain_name, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: DnsApi.get_domain_by_name ...'
      end
      # verify the required parameter 'domain_name' is set
      if @api_client.config.client_side_validation && domain_name.nil?
        fail ArgumentError, "Missing the required parameter 'domain_name' when calling DnsApi.get_domain_by_name"
      end
      # resource path
      local_var_path = '/api/v1/dns/domains/{domain_name}'.sub('{' + 'domain_name' + '}', domain_name.to_s)

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/dns'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = []
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'Domain')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: DnsApi#get_domain_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    def select_header_accept(accepts)
      return nil if accepts.nil? || accepts.empty?
      # use JSON when present, otherwise use all of the provided
      json_accept = accepts.find { |s| json_mime?(s) }
      json_accept || accepts.join(',')
    end
openapi-generator version

3.1.2

OpenAPI declaration file content or url
Command line used for generation

openapi-generator generate -i http://localhost:3000/api/v1/swagger.json -g ruby

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Assignee
Assign to
Time tracking