Skip to content

[BUG][Kotlin] Accept header overrides parameters #24529

Description

@wegendt-bosch

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

with a manual accept header as a header param, the generated code overrides passed in params with the inferred ones.

/endpoint:
  get:
    parameters:
      name: Accept
      required: false
      in: header
      description: |
          Media type that is acceptable by the client to control the content negotiation for the response.
      schema:
        type: string
        example: "application/json"
    responses:
      '200':
        content:
            application/octet-stream:
              schema:
                type: object
            application/json:
              schema:
                type: object

generates:

        accept?.apply { localVariableHeaders["Accept"] = this.toString() }
        localVariableHeaders["Accept"] = "application/octet-stream, application/json"

which makes the accept parameter ineffective.

openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions