Implementation:Microsoft Semantic kernel OpenApi TestPlugin DocumentV3
| Knowledge Sources | |
|---|---|
| Domains | OpenAPI, Testing, Azure_Key_Vault |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OpenAPI v3.0.1 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 JSON file is an OpenAPI v3.0.1 specification that models a sample Azure Key Vault REST API connector. It defines the same Azure Key Vault operations as the v2.0 counterpart but uses the OpenAPI 3.0 schema format with servers, components, and the requestBody construct instead of the Swagger 2.0 host/basePath/body parameter style.
Key features of this specification:
- Multiple servers - Defines both production (
https://my-key-vault.vault.azure.net) and PPE (https://ppe.my-key-vault.vault.azure.net) server URLs - GET /secrets/{secret-name} - Retrieve a secret with query parameters including array types with
styleandexplodeattributes - PUT /secrets/{secret-name} - Create or update a secret value with header parameters (
Accept,X-API-Version,X-Operation-Csv-Ids) and a JSON request body - Advanced parameter serialization styles (form, simple) and explode options
- Extension fields such as
x-ms-visibilityandx-ms-summary
Usage
This file is loaded during unit test execution to verify that the OpenAPI document parser correctly handles OpenAPI 3.0 format specifications. It is used to test parameter style/explode handling, multi-server support, header parameter extraction, and request body parsing. Developers extending the OpenAPI integration in Semantic Kernel rely on this fixture to ensure compatibility with OpenAPI 3.0 documents.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/src/Functions/Functions.UnitTests/OpenApi/TestPlugins/documentV3_0.json
- Lines: 1-576
Signature
{
"openapi": "3.0.1",
"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",
"operationId": "GetSecret",
"parameters": [
{
"name": "secret-name",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
]
}
}
}
}
Import
// Load the OpenAPI v3.0 document in unit tests
var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("documentV3_0.json");
// Or read directly from the TestPlugins directory
var json = File.ReadAllText("OpenApi/TestPlugins/documentV3_0.json");
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, explode=true |
| anotherExplodeFormParam | array of integer (query) | no | Integer array query parameter with default explode |
| 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 |
| requestBody | object (body) | yes (PUT) | JSON body containing secret value and attributes |
Outputs
| Name | Type | Description |
|---|---|---|
| 200 response | object | Default success response for GET operations |
| 200 response (PUT) | object | Response containing created/updated secret details |
Usage Examples
Parsing the OpenAPI 3.0 Document in a Unit Test
// Example: Loading and parsing the OpenAPI 3.0 test document
using var stream = File.OpenRead("OpenApi/TestPlugins/documentV3_0.json");
var operations = await OpenApiDocumentParser.ParseAsync(stream);
// Verify multi-server support
var getSecret = operations.First(op => op.Id == "GetSecret");
Assert.Equal("https://my-key-vault.vault.azure.net", getSecret.ServerUrl);
// Verify parameter style and explode settings
var nonExplode = getSecret.Parameters.First(p => p.Name == "nonExplodeFormParam");
Assert.Equal("form", nonExplode.Style);
Assert.False(nonExplode.Explode);