microsoft/kiota

Kiota warns that format:uri is not supported in headers

Open

#4,227 创建于 2024年2月25日

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

仓库指标

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

描述

We use "fornat": "uri" to describe the HTTP Location header in our OpenAPI file, for example:

{
  "responses": {
    "201": {
      "headers": {
        "Location": {
          "required": true,
          "schema": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  }
}

This triggers the following warning when running the Kiota command-line tool:

OpenAPI warning : #/paths/~1api~1tags/post/responses/201/headers/Location/schema - The format uri is not supported by Kiota and the string type will be used.

Headers are exposed by HeadersInspectionHandlerOption, which contains the following property:

public RequestHeaders ResponseHeaders { get; private set; } = new RequestHeaders();

RequestHeaders (note the name mismatch: response headers are stored in the request headers object, but that's beside the point) implements IDictionary<string, IEnumerable<string>>, so header values are always exposed as strings. This makes me wonder whether this warning should be emitted. The warning states it will use strings instead, but isn't that always the expected outcome for header values?

I'd rather not disable all warnings using --log-level Error when running Kiota, but without that, these show up as annoying warnings in the IDE (after running Kiota from an Exec task in the project file).

Would it make sense to suppress this warning for HTTP headers?

贡献者指南