Implementation:Microsoft Semantic kernel OpenApi TestPlugin DocumentV3 1
| Knowledge Sources | |
|---|---|
| Domains | OpenAPI, Testing, Azure_Key_Vault |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OpenAPI v3.1.0 YAML test specification document describing a sample Azure Key Vault connector, used as test fixture data in the Functions unit tests of the Semantic Kernel .NET SDK.
Description
This YAML file is an OpenAPI v3.1.0 specification that models a sample Azure Key Vault REST API connector. It mirrors the same operations defined in the v2.0 and v3.0 JSON counterparts but is written in YAML format and targets the OpenAPI 3.1 specification version. This allows the unit test suite to verify that the Semantic Kernel OpenAPI parser correctly handles the YAML format and any differences introduced in OpenAPI 3.1.
Key features of this specification:
- OpenAPI 3.1.0 version - Tests the latest supported OpenAPI specification version
- YAML format - Validates YAML parsing alongside JSON support
- Multiple servers - Production and PPE server URLs
- GET /secrets/{secret-name} - Secret retrieval with query array parameters using style and explode options
- PUT /secrets/{secret-name} - Secret creation/update with header parameters, request body, and
x-ms-*extensions - Parameter serialization styles (form, simple) matching the v3.0 specification
Usage
This file is loaded during unit test execution to verify that the OpenAPI document parser correctly handles OpenAPI 3.1 YAML specifications. It tests YAML-specific parsing, 3.1 schema differences, and ensures feature parity with JSON-based OpenAPI documents. Developers adding OpenAPI 3.1 support would use this fixture as a reference and test target.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/src/Functions/Functions.UnitTests/OpenApi/TestPlugins/documentV3_1.yaml
- Lines: 1-376
Signature
openapi: 3.1.0
info:
title: 'Azure Key Vault [Sample]'
description: 'A sample connector for the Azure Key Vault service.'
version: '1.0'
servers:
- url: https://my-key-vault.vault.azure.net
- url: https://ppe.my-key-vault.vault.azure.net
paths:
'/secrets/{secret-name}':
get:
summary: Get secret
description: 'Get a specified secret from a given key vault.'
operationId: GetSecret
parameters:
- name: secret-name
in: path
required: true
schema:
type: string
Import
// Load the OpenAPI v3.1 YAML document in unit tests
var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("documentV3_1.yaml");
// Or read directly from the TestPlugins directory
var yaml = File.ReadAllText("OpenApi/TestPlugins/documentV3_1.yaml");
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| secret-name | string (path) | yes | The name of the secret to retrieve or set |
| api-version | string (query) | yes | The Azure Key Vault API version (default: "7.0") |
| nonExplodeFormParam | array of string (query) | no | Query parameter with form style, explode=false |
| explodeFormParam | array of string (query) | no | Query parameter with form style, default explode |
| anotherExplodeFormParam | array of integer (query) | no | Integer array query parameter |
| Accept | string (header) | no | Content type the client understands (default: application/json) |
| X-API-Version | integer (header) | yes | Requested API version (default: 10) |
| X-Operation-Csv-Ids | array of string (header) | no | Comma separated list of operation ids (simple style) |
| requestBody | object (body) | yes (PUT) | JSON body containing secret value and attributes |
Outputs
| Name | Type | Description |
|---|---|---|
| 200 response | object | Default success response for GET operation |
| 200 response (PUT) | object | Response containing created/updated secret details |
Usage Examples
Parsing the OpenAPI 3.1 YAML Document in a Unit Test
// Example: Loading and parsing the OpenAPI 3.1 YAML test document
using var stream = File.OpenRead("OpenApi/TestPlugins/documentV3_1.yaml");
var operations = await OpenApiDocumentParser.ParseAsync(stream);
// Verify OpenAPI 3.1 is properly parsed
var getSecret = operations.First(op => op.Id == "GetSecret");
Assert.Equal("GET", getSecret.Method.ToString());
// Verify YAML-specific parameters are extracted
var pathParam = getSecret.Parameters.First(p => p.Name == "secret-name");
Assert.True(pathParam.IsRequired);
Assert.Equal("path", pathParam.Location);