Skip to content

$ref fragments are expected to be full openapi documents #7169

@esd-thg

Description

@esd-thg

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

Kiota will throw an error if a referenced fragment isn't a full openapi document

fail: Kiota.Builder.KiotaBuilder[0]
      OpenAPI error: (null) - [File: fragment.json] Version node not found.

Expected behavior

fragments do not need to be full openapi documents and can be just a fragment of it

How to reproduce

dotnet kiota generate -l CSharp -d <given openapi>

Open API description file

{
  "openapi": "3.0.1",
  "info": {
    "title": "Test API",
    "version": "v1"
  },
  "paths": {
    "/foo": {
      "$ref":  "fragment.json#/get"
    }
  }
}

fragment.json

{
  "get": {
    "responses": {
      "200": {
        "description": "Successful response",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}

Kiota Version

1.29.0

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

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    CsharpPull requests that update .net codestatus:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    Status

    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions