microsoft/kiota

Stream response for HEAD endpoint

Open

#4,245 创建于 2024年2月27日

在 GitHub 查看
 (5 评论) (0 反应) (0 负责人)C# (326 fork)auto 404
generatorhelp wantedtype:bug

仓库指标

Star
 (3,783 star)
PR 合并指标
 (PR 指标待抓取)

描述

When a HEAD endpoint contains only responses without a body (which should always be the case), Kiota generates Task<Stream?> as the response type. Is that intentional? I would have expected the return type to be Task.

Repro steps:

{
  "openapi": "3.0.1",
  "info": {
    "title": "OpenApiTests",
    "version": "1.0"
  },
  "paths": {
    "/countries": {
      "head": {
        "tags": [
          "countries"
        ],
        "operationId": "headCountryCollection",
        "responses": {
          "200": {
            "headers": {
              "ETag": {
                "required": true,
                "schema": {
                  "type": "string"
                }
              },
              "Content-Length": {
                "required": true,
                "schema": {
                  "type": "integer",
                  "format": "int64"
                }
              }
            }
          },
          "304": {
            "headers": {
              "ETag": {
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "The query string is invalid."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
    }
  }
}

Used command line:

dotnet kiota generate --language CSharp --class-name HeadersClient --namespace-name OpenApiKiotaEndToEndTests.Headers.GeneratedCode --output ./Headers/GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ../OpenApiTests/Headers/GeneratedSwagger/swagger.g.json

Generated client usage: image

贡献者指南