From 6bde544c762a0a277e3e79e5f4c85ab4d87cab3c Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Tue, 15 Apr 2025 16:11:28 +0100 Subject: [PATCH] Add TypeSpecGeneratorPlugin snippets. Closes #239 Closes #239 --- CHANGELOG.md | 4 +++- README.md | 2 ++ src/constants.ts | 11 +++++++++++ src/snippets.json | 35 ++++++++++++++++++++++++++++------- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcf7fb5..f9bc9b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Command: `dev-proxy-toolkit.config-new` - Create new configuration file - Command: `dev-proxy-toolkit.restart` - Restart Dev Proxy +- Snippets: `devproxy-plugin-typespec-generator` - TypeSpecGeneratorPlugin instance +- Snippets: `devproxy-plugin-typespec-generator-config` - TypeSpecGeneratorPlugin config section ### Changed: @@ -39,7 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added: -- Snippets: `devproxy-rewrite` - Dev Proxy rewrite +- Snippets: `devproxy-plugin-rewrite` - Dev Proxy rewrite - Snippets: `devproxy-plugin-rewrite-file` - RewritePlugin rewrites file - Snippets: `devproxy-plugin-rewrite-file-schema` - RewritePlugin rewrites file schema - Diagnostics: Show warning if config contains a summary plugin without a reporter diff --git a/README.md b/README.md index 92754e0..a5265c8 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,8 @@ Shown when the active document is a Dev Proxy configuration file | `devproxy-plugin-rewrite-file` | RewritePlugin rewrites file | | `devproxy-plugin-rewrite-file-schema` | RewritePlugin rewrites file schema | | `devproxy-plugin-rewrite-config` | RewritePlugin config section | +| `devproxy-plugin-typespec-generator` | TypeSpecGeneratorPlugin instance | +| `devproxy-plugin-typespec-generator-config` | TypeSpecGeneratorPlugin config section | | `devproxy-plugin-url-discovery` | UrlDiscoveryPlugin instance | | `devproxy-reporter-json` | JsonReporter instance | | `devproxy-reporter-markdown` | MarkdownReporter instance | diff --git a/src/constants.ts b/src/constants.ts index 519d584..b6243f1 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -189,6 +189,13 @@ export const pluginSnippets: PluginSnippets = { required: true, } }, + TypeSpecGeneratorPlugin: { + instance: 'devproxy-plugin-typespec-generator', + config: { + name: 'devproxy-plugin-typespec-generator-config', + required: false, + } + }, UrlDiscoveryPlugin: { instance: 'devproxy-plugin-url-discovery', }, @@ -332,6 +339,10 @@ export const pluginDocs: PluginDocs = { name: 'Rewrite Plugin', url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/rewriteplugin', }, + TypeSpecGeneratorPlugin: { + name: 'TypeSpec Generator Plugin', + url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/typespecgeneratorplugin', + }, UrlDiscoveryPlugin: { name: 'UrlDiscovery Plugin', url: 'https://learn.microsoft.com/microsoft-cloud/dev/dev-proxy/technical-reference/urldiscoveryplugin', diff --git a/src/snippets.json b/src/snippets.json index 40ad343..091e51b 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -110,7 +110,7 @@ ], "description": "Dev Proxy response header" }, - "Rewrite":{ + "Rewrite": { "prefix": "devproxy-rewrite", "body": [ "{", @@ -462,7 +462,7 @@ "\t\t\"https://graph.microsoft.us/beta/*\",", "\t\t\"https://dod-graph.microsoft.us/beta/*\",", "\t\t\"https://microsoftgraph.chinacloudapi.cn/beta/*\"", - "\t]", + "\t]", "}" ], "description": "GraphBetaSupportGuidancePlugin instance" @@ -947,7 +947,7 @@ ], "description": "RewritePlugin instance" }, - "RewritePluginFile":{ + "RewritePluginFile": { "prefix": "devproxy-plugin-rewrite-file", "body": [ "{", @@ -959,14 +959,14 @@ ], "description": "RewritePlugin rewrites file" }, - "RewritePluginFileSchema":{ + "RewritePluginFileSchema": { "prefix": "devproxy-plugin-rewrite-file-schema", "body": [ "\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/rewriteplugin.rewritesfile.schema.json\"," ], "description": "RewritePlugin rewrites file schema" }, - "RewritePluginConfig":{ + "RewritePluginConfig": { "prefix": "devproxy-plugin-rewrite-config", "body": [ "\"rewritePlugin\": {", @@ -975,8 +975,29 @@ "}" ], "description": "RewritePlugin config section" - }, - "UrlDiscoveryPlugin": { + }, + "TypeSpecGeneratorPlugin": { + "prefix": "devproxy-plugin-typespec-generator", + "body": [ + "{", + "\t\"name\": \"TypeSpecGeneratorPlugin\",", + "\t\"enabled\": true,", + "\t\"pluginPath\": \"~appFolder/plugins/dev-proxy-plugins.dll\"", + "}" + ], + "description": "TypeSpecGeneratorPlugin instance" + }, + "TypeSpecGeneratorPluginConfig": { + "prefix": "devproxy-plugin-typespec-generator-config", + "body": [ + "\"typeSpecGeneratorPlugin\": {", + "\t\"\\$schema\": \"https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/typespecgeneratorplugin.schema.json\",", + "\t\"ignoreResponseTypes\": false", + "}" + ], + "description": "TypeSpecGeneratorPlugin config section" + }, + "UrlDiscoveryPlugin": { "prefix": "devproxy-plugin-url-discovery", "body": [ "{",