Skip to content

Breaking change: Accept header is missing in generated client #6572

Closed
@bkoelman

Description

@bkoelman

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

After updating from 1.25.1 to 1.26.1, HTTP Accept headers are no longer being generated in some cases.

For example, when an endpoint defines multiple responses, where only some of them have a content type. In that case, the client should send an Accept header, to enable the server to respond with all possible statuses.

Expected behavior

Client sends an Accept header if at least one response defines a content type.

How to reproduce

Open API description file

{
  "openapi": "3.0.4",
  "paths": {
    "/api/tags/{id}/relationships/todoItems": {
      "post": {
        "summary": "Adds existing todoItems to the todoItems relationship of an individual tag.",
        "operationId": "postTagTodoItemsRelationship",
        "responses": {
          "204": {
            "description": "The todoItems were successfully added, which did not result in additional changes."
          },
          "400": {
            "description": "The request body is missing or malformed.",
            "content": {
              "application/vnd.api+json; ext=openapi": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponseDocument"
                }
              }
            }
          },
          "404": {
            "description": "The tag or a related resource does not exist.",
            "content": {
              "application/vnd.api+json; ext=openapi": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponseDocument"
                }
              }
            }
          },
          "409": {
            "description": "The request body contains conflicting information or another resource with the same ID already exists.",
            "content": {
              "application/vnd.api+json; ext=openapi": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponseDocument"
                }
              }
            }
          },
          "422": {
            "description": "Validation of the request body failed.",
            "content": {
              "application/vnd.api+json; ext=openapi": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponseDocument"
                }
              }
            }
          }
        }
      }
    },
  }
}

Kiota Version

1.26.1

Latest Kiota version known to work for scenario above?(Not required)

1.25.1

Known Workarounds

No response

Configuration

No response

Debug output

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

generatorIssues or improvements relater to generation capabilities.priority:p1High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7daystype:bugA broken experiencetype:regressionA bug from previous release

Type

Projects

Status

Done ✔️

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions