Dev Proxy Toolkit の診断

Dev Proxy Toolkit VS Code 拡張機能は、開発プロキシ構成ファイルを分析し、潜在的な問題を強調します。 各診断には、解決ガイダンスのためにこのページにリンクするコードがあります。

診断コードリファレンス

Code Severity Description
apiCenterPluginOrder Warnung API センターのプラグインの順序が正しくありません
deprecatedPluginPath エラー 古いプラグイン DLL パスの使用
emptyUrlsToWatch 情報 インターセプトするように構成された URL がない
invalidConfigSection Warnung 孤立した構成セクション
invalidConfigSectionSchema Warnung 構成セクションスキーマのバージョンの不一致
invalidConfigValue エラー config セクションの値が無効です
invalidSchema Warnung インストールされている開発プロキシとのスキーマ バージョンの不一致
missingLanguageModel 情報 プラグインは、ローカル言語モデルを使用して出力を向上させることができます
noEnabledPlugins Warnung プラグインが有効になっていません
pluginConfigMissing エラー/警告 参照先の構成セクションがありません
pluginConfigNotRequired エラー/警告 不要な構成セクション
pluginConfigRequired エラー/警告 プラグインには構成が必要です
reporterPosition Warnung リストの末尾にないレポーター プラグイン
summaryWithoutReporter Warnung レポーターなしの概要プラグイン
unknownConfigProperty Warnung config セクションの不明なプロパティ

apiCenterPluginOrder

重大 度: 警告
利用可能なクイック修正: いいえ

OpenApiSpecGeneratorPlugin は、 ApiCenterOnboardingPluginの後に配置されます。

原因

OpenApiSpecGeneratorPlugin は、OpenAPI 仕様を使用 ApiCenterOnboardingPlugin 前に生成する必要があります。

解決策

OpenApiSpecGeneratorPluginの前にApiCenterOnboardingPluginを配置します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "OpenApiSpecGeneratorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    },
    {
      "name": "ApiCenterOnboardingPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "apiCenterOnboardingPlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "apiCenterOnboardingPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/apicenteronboardingplugin.schema.json",
    "subscriptionId": "your-subscription-id",
    "resourceGroupName": "your-resource-group",
    "serviceName": "your-api-center",
    "workspaceName": "default"
  }
}

deprecatedPluginPath

重大 度: エラー
利用可能なクイック修正: はい

pluginPathでは、非推奨のパス形式が使用されます。

原因

開発プロキシ v0.29 では、プラグイン DLL の名前が dev-proxy-plugins.dll から DevProxy.Plugins.dll に変更されました。

解決策

新しい形式を使用するように pluginPath を更新します。 クイック修正を使用して自動的に更新します。

{
  "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
}

emptyUrlsToWatch

重大 度: 情報
利用可能なクイック修正: いいえ

urlsToWatch配列が空です。

原因

開発プロキシは、 urlsToWatch を使用して、インターセプトする要求を決定します。 空の配列は、要求が処理されていないことを意味します。

解決策

インターセプトする URL パターンを追加します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "MockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockResponsePlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*",
    "https://graph.microsoft.com/v1.0/*"
  ],
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  }
}

invalidConfigSection

重大 度: 警告
利用可能なクイック修正: いいえ

構成セクションは存在しますが、それを参照するプラグインはありません。

原因

最上位レベルのオブジェクトが存在し、どのプラグインでも configSection として使用されません。 これは多くの場合、プラグインを削除した後、その構成を削除することを忘れた後に発生します。

解決策

孤立したセクションを削除するか、それを参照するプラグインを追加します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "GenericRandomErrorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "genericRandomErrorPlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "genericRandomErrorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/genericrandomerrorplugin.schema.json",
    "rate": 50
  }
}

invalidConfigSectionSchema

重大 度: 警告
利用可能なクイック修正: はい

config セクションの $schema プロパティが、インストールされている開発プロキシのバージョンと一致しません。

原因

config セクションは、インストールされている開発プロキシとは異なるスキーマ バージョンを参照します。 これにより、検証の問題や機能の不足が発生する可能性があります。

解決策

config セクションの $schema プロパティを、インストールされているバージョンに合わせて更新します。 クイック修正 (電球アイコンまたは Ctrl+. / Cmd+.) を使用して、自動的に更新します。

{
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  }
}

invalidConfigValue

重大 度: エラー
利用可能なクイック修正: いいえ

config セクションのプロパティ値が、スキーマで定義されている予期される型または制約と一致しません。

原因

値が正しくない型 (たとえば、数値ではなく文字列)、許容範囲外、または有効なオプションの一覧にない可能性があります。

解決策

スキーマのドキュメントで期待される値の形式を確認し、それに応じて更新します。

{
  "genericRandomErrorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/genericrandomerrorplugin.schema.json",
    "rate": 50
  }
}

invalidSchema

重大 度: 警告
利用可能なクイック修正: はい

$schema プロパティは、インストールされている開発プロキシのバージョンと一致しません。

原因

構成で、インストールされている開発プロキシとは異なるスキーマ バージョンが参照されます。 これにより、検証の問題や機能の不足が発生する可能性があります。

解決策

$schema プロパティを、インストールされているバージョンに合わせて更新します。 クイック修正 (電球アイコンまたは Ctrl+. / Cmd+.) を使用して、自動的に更新します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json"
}

missingLanguageModel

重大 度: 情報
利用可能なクイック修正: はい

プラグインはローカル言語モデルを使用できますが、 languageModel.enabledtrueされません。

原因

OpenAIMockResponsePluginOpenApiSpecGeneratorPluginTypeSpecGeneratorPluginなどのプラグインでは、ローカル言語モデルを使用して出力を向上させることができます。 開発プロキシをローカル言語モデルに接続することで、追加のコストを発生させることなく、機能の向上を活用できます。

解決策

languageModel構成を追加または更新します。 クイック修正を使用して、 languageModel.enabled: true を自動的に追加または更新します。 詳細については、「 開発プロキシでローカル言語モデルを使用する」を参照してください。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "OpenAIMockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "openAIMockResponsePlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.openai.com/*"
  ],
  "languageModel": {
    "enabled": true
  },
  "openAIMockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/openaimockresponseplugin.schema.json"
  }
}

noEnabledPlugins

重大 度: 警告
利用可能なクイック修正: いいえ

plugins配列が空であるか、すべてのプラグインが無効になっています。

原因

Dev Proxy では、要求を処理するために、少なくとも 1 つの有効なプラグインが必要です。

解決策

enabled: trueで少なくとも 1 つのプラグインを追加します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "MockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockResponsePlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  }
}

pluginConfigMissing

重大 度: エラー (有効なプラグイン) / 警告 (無効なプラグイン)
利用可能なクイック修正: いいえ

プラグインは、存在しない configSection を参照します。

原因

プラグインには configSection プロパティがありますが、対応する構成オブジェクトがファイルに存在しません。

解決策

不足している構成セクションを追加します。 診断メッセージに表示されるスニペット名を使用します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "MockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockResponsePlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  }
}

pluginConfigNotRequired

重大 度: エラー (有効なプラグイン) / 警告 (無効なプラグイン)
利用可能なクイック修正: いいえ

プラグインには configSection がありますが、構成はサポートされていません。

原因

すべてのプラグインがカスタム構成をサポートしているわけではありません。 必要のないプラグインに configSection を追加しても効果はありません。

解決策

configSection プロパティを削除します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "RetryAfterPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ]
}

pluginConfigRequired

重大 度: エラー (有効なプラグイン) / 警告 (無効なプラグイン)
利用可能なクイック修正: いいえ

プラグインには configSection が必要ですが、何も指定されていません。

原因

一部のプラグインでは、機能するために構成が必要です。 プラグイン定義に configSection プロパティがありません。

解決策

configSection プロパティを追加し、構成オブジェクトを作成します。 診断メッセージに表示されるスニペット名を使用します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "GenericRandomErrorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "genericRandomErrorPlugin"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "genericRandomErrorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/genericrandomerrorplugin.schema.json",
    "errorsFile": "errors.json",
    "rate": 50
  }
}

reporterPosition

重大 度: 警告
利用可能なクイック修正: いいえ

レポーター プラグインは、他の非レポート プラグインの前に配置されます。

原因

レポーター プラグインは、他のプラグインから出力を収集します。 他のプラグインの前に配置すると、すべてのデータがキャプチャされるわけではありません。

解決策

レポーター プラグインを plugins 配列の末尾に移動します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "MockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockResponsePlugin"
    },
    {
      "name": "LatencyPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "latencyPlugin"
    },
    {
      "name": "PlainTextReporter",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ],
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  },
  "latencyPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/latencyplugin.schema.json",
    "minMs": 200,
    "maxMs": 10000
  }
}

summaryWithoutReporter

重大 度: 警告
利用可能なクイック修正: いいえ

概要プラグインは、レポーター プラグインなしで有効になります。

原因

ExecutionSummaryPluginUrlDiscoveryPluginなどのプラグインは、レポーター プラグインを出力する必要があるデータを生成します。

解決策

概要プラグインの後にレポーター プラグインを追加します。

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "ExecutionSummaryPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    },
    {
      "name": "PlainTextReporter",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
    }
  ],
  "urlsToWatch": [
    "https://api.example.com/*"
  ]
}

unknownConfigProperty

重大 度: 警告
利用可能なクイック修正: はい

構成セクションには、スキーマで定義されていないプロパティが含まれています。

原因

このプロパティのスペルが間違っているか、別の開発プロキシ バージョンから取得されたか、このプラグインに存在しない可能性があります。

解決策

不明なプロパティを削除または名前変更します。 クイック修正を使用して自動的に削除します。

{
  "mockResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v3.1.0/mockresponseplugin.schema.json",
    "mocksFile": "mocks.json"
  }
}