從攔截的要求和回應產生 JSON 格式的 OpenAPI 規格。
外掛程式實例定義
{
"name": "OpenApiSpecGeneratorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "openApiSpecGeneratorPlugin"
}
設定範例
{
"openApiSpecGeneratorPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/openapispecgeneratorplugin.schema.json",
"includeOptionsRequests": false,
"ignoreResponseTypes": false,
"specVersion": "v3_0",
"specFormat": "Json",
"includeParameters": [
"api-version"
]
}
}
設定屬性
| Property | Description | Default |
|---|---|---|
includeOptionsRequests |
判斷是否要在 OPTIONS 產生的 OpenAPI 規格中包含要求 |
false |
ignoreResponseTypes |
決定是否要忽略產生的 OpenAPI 規格中的回應類型。 | false |
specVersion |
決定要用於所產生 OpenAPI 規格的版本。可以設定為 v2_0 或 v3_0 |
v3_0 |
specFormat |
決定要用於所產生 OpenAPI 規格的格式。可以設定為 Json 或 Yaml |
Json |
includeParameters |
決定要包含在產生的 OpenAPI 規格中,以及其預設值的查詢字串參數清單。 | [] |
命令列選項
None
Remarks
若要建立更佳的 OpenAPI 規格,請考慮搭配開發 Proxy 使用本機語言模型。 使用本機語言模型, OpenApiSpecGeneratorPlugin 會產生更清楚的作業標識符和描述,讓您有更好的 OpenAPI 規格起點。若要搭配 使用本機語言模型與 OpenApiSpecGeneratorPlugin,請在組態檔中啟用語言模型。 如需詳細資訊,請參閱 使用本機語言模型。