Skip to content

.Net Bug: OpenAPI descriptions with server variables are not supported #8193

@calebkiage

Description

@calebkiage

Describe the bug
According to the OpenAPI spec, the servers array might contain path variables which can be replaced with user defined values to build a proper URL. Semantic Kernel currently assumes that the URL is a valid URL and fails to create a plugin if it isn't.

An example OpenAPI:

{
  "openapi": "3.0.3",
  "info": {
    "title": "Test Schema",
    "version": "0"
  },
  "servers": [
    {
      "url": "https://example.com/{version}",
      "variables": {
        "version": {
          "default": "v2",
          "enum": [
            "v1", "v2"
          ]
        }
      }
    }
  ],
  "paths": {
    "/": {
      "get": {
        "operationId": "getRoot",
        "responses": {
          "default": {
            "description": ""
          }
        }
      }
    }
  }
}

Expected behavior
Semantic Kernel should fill in the parameters before constructing a request. In the above example, the getRoot operation request uses the URL https://example.com/{version}/ instead of https://example.com/v2/

Platform

  • OS: Windows
  • IDE: VS Code
  • Language: C#
  • Source: main branch of repository

Additional context

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't workingopenapiIssues related to the OpenAPI function importer

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions