├── .vscode └── .gitignore ├── .gitattributes ├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── dotnet-required-workaround.yml │ └── codeql-required-workaround.yml ├── media ├── icon.ico ├── icon.png ├── banner.png ├── icon_bg.png ├── icon-beta.ico └── icon-beta.png ├── DevProxy ├── config │ └── picture.jpg ├── msgraph-openapi-v1.db ├── ApiControllers │ └── JwtInfo.cs ├── prompts │ ├── singular_noun.prompty │ ├── lmfailure_outdated-information.prompty │ ├── lmfailure_over-specification.prompty │ ├── api_service_name.prompty │ ├── lmfailure_ambiguity-vagueness.prompty │ ├── lmfailure_hallucination.prompty │ ├── lmfailure_bias-stereotyping.prompty │ ├── lmfailure_incorrect-format-style.prompty │ ├── lmfailure_overgeneralization.prompty │ ├── lmfailure_circular-reasoning.prompty │ ├── lmfailure_contradictory-information.prompty │ ├── lmfailure_misinterpretation.prompty │ ├── lmfailure_plausible-incorrect.prompty │ ├── lmfailure_failure-disclaim-hedge.prompty │ ├── lmfailure_overconfidence-uncertainty.prompty │ ├── lmfailure_failure-follow-instructions.prompty │ ├── lmfailure_overreliance-prior-conversation.prompty │ └── api_operation_description.prompty ├── Logging │ ├── ProxyConsoleFormatterOptions.cs │ └── ILoggerExtensions.cs ├── Plugins │ └── PluginReference.cs ├── Proxy │ ├── IProxyState.cs │ ├── IProxyStateController.cs │ ├── ProxyState.cs │ └── InactivityTimer.cs ├── toggle-proxy.sh ├── remove-cert.sh ├── Jwt │ ├── JwtTokenGenerator.cs │ └── JwtOptions.cs └── trust-cert.sh ├── scripts ├── version.ps1 └── local-docker.ps1 ├── CODE_OF_CONDUCT.md ├── DevProxy.Abstractions ├── Proxy │ ├── UrlToWatch.cs │ ├── IProxyLogger.cs │ └── ResponseState.cs ├── LanguageModel │ ├── ILanguageModelChatCompletionMessage.cs │ ├── CompletionOptions.cs │ ├── ILanguageModelCompletionResponse.cs │ ├── LanguageModelConfiguration.cs │ └── ILanguageModelClient.cs ├── Plugins │ └── IReport.cs └── Models │ ├── GraphBatchRequestPayload.cs │ └── MockRequest.cs ├── DevProxy.Plugins ├── Models │ ├── GraphPermissionsType.cs │ ├── ApiPermissionError.cs │ ├── GraphResultsAndErrors.cs │ ├── ApiOperation.cs │ ├── GraphRequestInfo.cs │ ├── GraphPermissionError.cs │ ├── ApiPermissionsInfo.cs │ ├── GraphPermissionInfo.cs │ └── GraphErrorObjects.cs └── Utils │ ├── MethodAndUrlUtils.cs │ └── MessageUtils.cs ├── SUPPORT.md ├── schemas ├── v0.25.0 │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── mockrequestplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── latencyplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── graphconnectornotificationplugin.schema.json │ ├── genericrandomerrorplugin.schema.json │ ├── openapispecgeneratorplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── apicenterminimalpermissionsplugin.schema.json │ ├── apicenterproductionversionplugin.schema.json │ ├── graphrandomerrorplugin.schema.json │ ├── mockresponseplugin.schema.json │ ├── apicenteronboardingplugin.schema.json │ └── ratelimitingplugin.customresponsefile.schema.json ├── v0.26.0 │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── mockrequestplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── latencyplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── graphconnectornotificationplugin.schema.json │ ├── genericrandomerrorplugin.schema.json │ ├── openapispecgeneratorplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── apicenterminimalpermissionsplugin.schema.json │ ├── apicenterproductionversionplugin.schema.json │ ├── graphrandomerrorplugin.schema.json │ ├── mockresponseplugin.schema.json │ ├── apicenteronboardingplugin.schema.json │ └── ratelimitingplugin.customresponsefile.schema.json ├── v0.27.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v0.28.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v0.29.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v0.29.1 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v0.29.2 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v1.0.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── minimalpermissionsguidanceplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── mockresponseplugin.schema.json │ └── languagemodelfailureplugin.schema.json ├── v1.1.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── mockresponseplugin.schema.json │ └── languagemodelfailureplugin.schema.json ├── v1.2.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v1.2.1 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ └── mockresponseplugin.schema.json ├── v1.3.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── mockresponseplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ └── hargeneratorplugin.schema.json ├── v2.0.0 │ ├── mockrequestplugin.schema.json │ ├── crudapiplugin.schema.json │ ├── cachingguidanceplugin.schema.json │ ├── httpfilegeneratorplugin.schema.json │ ├── typespecgeneratorplugin.schema.json │ ├── minimalcsompermissionsplugin.schema.json │ ├── rewriteplugin.schema.json │ ├── executionsummaryplugin.schema.json │ ├── devtoolsplugin.schema.json │ ├── graphminimalpermissionsplugin.schema.json │ ├── latencyplugin.schema.json │ ├── graphminimalpermissionsguidanceplugin.schema.json │ ├── mockresponseplugin.schema.json │ ├── minimalpermissionsplugin.schema.json │ └── hargeneratorplugin.schema.json ├── v0.14.1 │ └── ratelimitingplugin.schema.json ├── v0.15.0 │ └── ratelimitingplugin.schema.json ├── v0.16.0 │ └── ratelimitingplugin.schema.json ├── v0.16.1 │ └── ratelimitingplugin.schema.json ├── v0.16.2 │ └── ratelimitingplugin.schema.json ├── v0.17.0 │ └── ratelimitingplugin.schema.json ├── v0.17.1 │ └── ratelimitingplugin.schema.json ├── v0.18.0 │ └── ratelimitingplugin.schema.json ├── v0.19.0 │ └── ratelimitingplugin.schema.json ├── v0.19.1 │ └── ratelimitingplugin.schema.json ├── v0.20.0 │ └── ratelimitingplugin.schema.json ├── v0.20.1 │ └── ratelimitingplugin.schema.json ├── v0.21.0 │ └── ratelimitingplugin.schema.json ├── v0.22.0 │ └── ratelimitingplugin.schema.json ├── v0.23.0 │ └── ratelimitingplugin.schema.json └── v0.24.0 │ └── ratelimitingplugin.schema.json └── tests └── devproxy-api.http /.vscode/.gitignore: -------------------------------------------------------------------------------- 1 | settings.json -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.sh text eol=lf -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @dotnet/dev-proxy-maintainers -------------------------------------------------------------------------------- /media/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/icon.ico -------------------------------------------------------------------------------- /media/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/icon.png -------------------------------------------------------------------------------- /media/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/banner.png -------------------------------------------------------------------------------- /media/icon_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/icon_bg.png -------------------------------------------------------------------------------- /media/icon-beta.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/icon-beta.ico -------------------------------------------------------------------------------- /media/icon-beta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/media/icon-beta.png -------------------------------------------------------------------------------- /DevProxy/config/picture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/DevProxy/config/picture.jpg -------------------------------------------------------------------------------- /DevProxy/msgraph-openapi-v1.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnet/dev-proxy/HEAD/DevProxy/msgraph-openapi-v1.db -------------------------------------------------------------------------------- /scripts/version.ps1: -------------------------------------------------------------------------------- 1 | # Licensed to the .NET Foundation under one or more agreements. 2 | # The .NET Foundation licenses this file to you under the MIT license. 3 | # See the LICENSE file in the project root for more information. 4 | 5 | $script:versionString = "v2.0.0-beta.1" 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | 6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 7 | -------------------------------------------------------------------------------- /DevProxy.Abstractions/Proxy/UrlToWatch.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace DevProxy.Abstractions.Proxy; 4 | 5 | public class UrlToWatch(Regex url, bool exclude = false) 6 | { 7 | public bool Exclude { get; } = exclude; 8 | public Regex Url { get; } = url; 9 | } -------------------------------------------------------------------------------- /DevProxy/ApiControllers/JwtInfo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.ApiControllers; 6 | 7 | sealed class JwtInfo 8 | { 9 | public required string Token { get; set; } 10 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphPermissionsType.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | public enum GraphPermissionsType 8 | { 9 | Application, 10 | Delegated 11 | } -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | ## How to file issues and get help 4 | 5 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue. 6 | 7 | ## Microsoft Support Policy 8 | 9 | Support for this **PROJECT** is limited to the resources listed above. 10 | -------------------------------------------------------------------------------- /schemas/v0.25.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "cacheThresholdSeconds": { 10 | "type": "integer" 11 | } 12 | }, 13 | "additionalProperties": false 14 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "cacheThresholdSeconds": { 10 | "type": "integer" 11 | } 12 | }, 13 | "additionalProperties": false 14 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "includeOptionsRequests": { 10 | "type": "boolean" 11 | } 12 | }, 13 | "additionalProperties": false 14 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "includeOptionsRequests": { 10 | "type": "boolean" 11 | } 12 | }, 13 | "additionalProperties": false 14 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "typesFilePath": { 10 | "type": "string" 11 | } 12 | }, 13 | "additionalProperties": false 14 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "apiFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "apiFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "apiFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "apiFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: nuget 4 | directories: 5 | - "/dev-proxy" 6 | - "/dev-proxy-abstractions" 7 | - "/dev-proxy-plugins" 8 | schedule: 9 | interval: daily 10 | 11 | - package-ecosystem: "docker" 12 | directory: "/" 13 | schedule: 14 | interval: daily 15 | 16 | - package-ecosystem: "github-actions" 17 | directory: "/" 18 | schedule: 19 | interval: daily -------------------------------------------------------------------------------- /schemas/v0.25.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "mockFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "mockFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "rewritesFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "rewritesFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "mockFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "mockFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "rewritesFile": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "rewritesFile" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/ApiPermissionError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | public class ApiPermissionError 8 | { 9 | public required string Error { get; init; } 10 | public required string Request { get; init; } 11 | } 12 | -------------------------------------------------------------------------------- /schemas/v0.25.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "apiSpecsFolderPath": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "apiSpecsFolderPath" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "apiSpecsFolderPath": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "apiSpecsFolderPath" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /tests/devproxy-api.http: -------------------------------------------------------------------------------- 1 | GET http://localhost:8897/proxy 2 | 3 | ### 4 | 5 | POST http://localhost:8897/proxy 6 | content-type: application/json 7 | 8 | { 9 | "recording": true 10 | } 11 | 12 | ### 13 | 14 | POST http://localhost:8897/proxy 15 | content-type: application/json 16 | 17 | { 18 | "recording": false 19 | } 20 | 21 | ### 22 | 23 | POST http://localhost:8897/proxy/raiseMockRequest 24 | 25 | ### 26 | 27 | POST http://localhost:8897/proxy/stopProxy 28 | -------------------------------------------------------------------------------- /schemas/v0.25.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "groupBy": { 10 | "type": "string", 11 | "enum": [ 12 | "url", 13 | "messageType" 14 | ] 15 | } 16 | }, 17 | "additionalProperties": false 18 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "groupBy": { 10 | "type": "string", 11 | "enum": [ 12 | "url", 13 | "messageType" 14 | ] 15 | } 16 | }, 17 | "additionalProperties": false 18 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/LanguageModel/ILanguageModelChatCompletionMessage.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.LanguageModel; 6 | 7 | public interface ILanguageModelChatCompletionMessage 8 | { 9 | object Content { get; set; } 10 | string Role { get; set; } 11 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "minMs": { 10 | "type": "integer", 11 | "minimum": 0 12 | }, 13 | "maxMs": { 14 | "type": "integer", 15 | "minimum": 0 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "minMs": { 10 | "type": "integer", 11 | "minimum": 0 12 | }, 13 | "maxMs": { 14 | "type": "integer", 15 | "minimum": 0 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "apiSpecsFolderPath": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "apiSpecsFolderPath" 15 | ], 16 | "additionalProperties": false 17 | } -------------------------------------------------------------------------------- /scripts/local-docker.ps1: -------------------------------------------------------------------------------- 1 | # Licensed to the .NET Foundation under one or more agreements. 2 | # The .NET Foundation licenses this file to you under the MIT license. 3 | # See the LICENSE file in the project root for more information. 4 | 5 | . (Join-Path $PSScriptRoot "version.ps1") 6 | . (Join-Path $PSScriptRoot "local-build.ps1") 7 | 8 | $version = $versionString.Substring(1) 9 | 10 | docker build --build-arg DEVPROXY_VERSION=$version -t dev-proxy-local:$version -f Dockerfile_local .. -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphResultsAndErrors.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | internal sealed class GraphResultsAndErrors 8 | { 9 | public GraphPermissionError[]? Errors { get; set; } 10 | public GraphPermissionInfo[]? Results { get; set; } 11 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "preferredBrowser": { 10 | "type": "string", 11 | "enum": [ 12 | "Edge", 13 | "EdgeDev", 14 | "Chrome" 15 | ] 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "type": { 10 | "type": "string", 11 | "enum": [ 12 | "Delegated", 13 | "Application" 14 | ] 15 | } 16 | }, 17 | "additionalProperties": false 18 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "preferredBrowser": { 10 | "type": "string", 11 | "enum": [ 12 | "Edge", 13 | "EdgeDev", 14 | "Chrome" 15 | ] 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "type": { 10 | "type": "string", 11 | "enum": [ 12 | "Delegated", 13 | "Application" 14 | ] 15 | } 16 | }, 17 | "additionalProperties": false 18 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/ApiOperation.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | public class ApiOperation 8 | { 9 | public required string Method { get; init; } 10 | public required string OriginalUrl { get; init; } 11 | public required string TokenizedUrl { get; init; } 12 | } -------------------------------------------------------------------------------- /DevProxy/prompts/singular_noun.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Singular Noun 3 | description: Make the provided noun singular. 4 | authors: 5 | - Dev Proxy 6 | model: 7 | api: chat 8 | parameters: 9 | temperature: 1.0 10 | sample: 11 | noun: houses 12 | --- 13 | 14 | system: 15 | You are an expert in English grammar. Your task is to convert the provided noun 16 | into its singular form. Respond with just the singular noun without any 17 | additional text or explanation. Don't translate the noun. 18 | 19 | user: 20 | Noun: `{{noun}}` 21 | -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphRequestInfo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Text.Json.Serialization; 6 | 7 | namespace DevProxy.Plugins.Models; 8 | 9 | public class GraphRequestInfo 10 | { 11 | public string Method { get; set; } = string.Empty; 12 | [JsonPropertyName("requestUrl")] 13 | public string Url { get; set; } = string.Empty; 14 | } -------------------------------------------------------------------------------- /DevProxy/Logging/ProxyConsoleFormatterOptions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Microsoft.Extensions.Logging.Console; 6 | 7 | namespace DevProxy.Logging; 8 | 9 | sealed class ProxyConsoleFormatterOptions : ConsoleFormatterOptions 10 | { 11 | public bool ShowSkipMessages { get; set; } = true; 12 | 13 | public bool ShowTimestamps { get; set; } = true; 14 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_outdated-information.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Outdated Information 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that uses outdated or no longer accurate information. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_over-specification.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Over-specification 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that adds extra details or assumptions not present in the prompt. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphPermissionError.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Text.Json.Serialization; 6 | 7 | namespace DevProxy.Plugins.Models; 8 | 9 | internal sealed class GraphPermissionError 10 | { 11 | public string Message { get; set; } = string.Empty; 12 | [JsonPropertyName("requestUrl")] 13 | public string Url { get; set; } = string.Empty; 14 | } -------------------------------------------------------------------------------- /DevProxy/prompts/api_service_name.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: API Service Name 3 | description: Generate a descriptive name for an API service based on the provided host name. 4 | authors: 5 | - Dev Proxy 6 | model: 7 | api: chat 8 | parameters: 9 | temperature: 1.0 10 | sample: 11 | host_name: graph.microsoft.com 12 | --- 13 | 14 | system: 15 | You are an expert in naming API services. Based on the provided host name, 16 | generate a descriptive name of an API service hosted on this URL. Respond with 17 | just the name. 18 | 19 | user: 20 | Host name: `{{host_name}}` 21 | -------------------------------------------------------------------------------- /schemas/v0.27.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/mockrequestplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockRequestPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mockFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock request." 13 | } 14 | }, 15 | "required": [ 16 | "mockFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/LanguageModel/CompletionOptions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Text.Json.Serialization; 6 | 7 | namespace DevProxy.Abstractions.LanguageModel; 8 | 9 | public class CompletionOptions 10 | { 11 | [JsonPropertyName("temperature")] 12 | public double? Temperature { get; set; } 13 | [JsonPropertyName("top_p")] 14 | public double? TopP { get; set; } 15 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_ambiguity-vagueness.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Ambiguity or Vagueness 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that is ambiguous, overly vague, or evasive, even if clarity was requested. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_hallucination.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Hallucination 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response where the model invents details or facts that don't exist, even if they sound credible. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /schemas/v0.27.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/crudapiplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CrudApiPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiFile": { 11 | "type": "string", 12 | "description": "Path to the file that contains the definition of the CRUD API." 13 | } 14 | }, 15 | "required": [ 16 | "apiFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_bias-stereotyping.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bias or Stereotyping 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that reflects a biased or stereotyped assumption without overt malicious intent. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_incorrect-format-style.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Incorrect Format or Style 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that uses the wrong format, tone, or style from what the prompt requested. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy.Abstractions/Plugins/IReport.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.Plugins; 6 | 7 | public interface IJsonReport 8 | { 9 | string FileExtension { get; } 10 | 11 | object ToJson(); 12 | } 13 | 14 | public interface IMarkdownReport 15 | { 16 | string? ToMarkdown(); 17 | } 18 | 19 | public interface IPlainTextReport 20 | { 21 | string? ToPlainText(); 22 | } 23 | -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_overgeneralization.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Overgeneralization 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that overgeneralizes, failing to tailor the answer to the specific details of the prompt. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /schemas/v0.27.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/httpfilegeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HttpFileGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeOptionsRequests": { 11 | "type": "boolean", 12 | "description": "Determines whether to include OPTIONS requests in the generated HTTP file. Default: false." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_circular-reasoning.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Circular Reasoning 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response where the model uses circular reasoning or restates the question without adding explanation. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_contradictory-information.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Contradictory Information 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that contradicts itself or previous statements made earlier in the conversation. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_misinterpretation.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Misinterpretation of prompt 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response where the model misinterprets the question or misunderstands what the user is asking. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /schemas/v0.27.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/cachingguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy CachingGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "cacheThresholdSeconds": { 11 | "type": "integer", 12 | "description": "The number of seconds between the same request that triggers the guidance warning. Default is 5." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_plausible-incorrect.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Plausible but incorrect 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that sounds confident and well-written but contains subtle factual errors or incorrect logic. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_failure-disclaim-hedge.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Failure to Disclaim or Hedge 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that presents potentially sensitive or speculative content without caveats or disclaimers. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_overconfidence-uncertainty.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Overconfidence in Uncertainty 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that expresses unwarranted confidence, even when the answer should be uncertain or nuanced. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /DevProxy/Plugins/PluginReference.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins; 6 | 7 | internal sealed class PluginReference 8 | { 9 | public bool Enabled { get; set; } = true; 10 | public string? ConfigSection { get; set; } 11 | public string Name { get; set; } = string.Empty; 12 | public string PluginPath { get; set; } = string.Empty; 13 | public List? UrlsToWatch { get; set; } 14 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_failure-follow-instructions.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Failure to Follow Instructions 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that ignores one or more explicit instructions given in the prompt (e.g., structure, tone, length). 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /schemas/v0.25.0/graphconnectornotificationplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphConnectorNotificationPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "audience": { 10 | "type": "string" 11 | }, 12 | "mockFile": { 13 | "type": "string" 14 | }, 15 | "tenant": { 16 | "type": "string" 17 | } 18 | }, 19 | "required": [ 20 | "audience", 21 | "mockFile", 22 | "tenant" 23 | ], 24 | "additionalProperties": false 25 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/graphconnectornotificationplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphConnectorNotificationPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "audience": { 10 | "type": "string" 11 | }, 12 | "mockFile": { 13 | "type": "string" 14 | }, 15 | "tenant": { 16 | "type": "string" 17 | } 18 | }, 19 | "required": [ 20 | "audience", 21 | "mockFile", 22 | "tenant" 23 | ], 24 | "additionalProperties": false 25 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/LanguageModel/ILanguageModelCompletionResponse.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.LanguageModel; 6 | 7 | public interface ILanguageModelCompletionResponse 8 | { 9 | string? ErrorMessage { get; } 10 | string? Response { get; } 11 | // custom property added to log in the mock output 12 | string? RequestUrl { get; set; } 13 | 14 | OpenAIResponse ConvertToOpenAIResponse(); 15 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/typespecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy TypeSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "ignoreResponseTypes": { 11 | "type": "boolean", 12 | "description": "Determines whether to generate types for API responses (false) or to set them to 'string' (true)." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/minimalcsompermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalCsomPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "typesFilePath": { 11 | "type": "string", 12 | "description": "Path to the file that lists permissions required to call SharePoint CSOM APIs. Default: ~appFolder/config/spo-csom-types.json." 13 | } 14 | }, 15 | "additionalProperties": false 16 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/rewriteplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RewritePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The URL of the JSON schema used to validate this configuration file." 9 | }, 10 | "rewritesFile": { 11 | "type": "string", 12 | "description": "Path to the file containing rewrite definitions (e.g., 'rewrites.json')." 13 | } 14 | }, 15 | "required": [ 16 | "rewritesFile" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /DevProxy/prompts/lmfailure_overreliance-prior-conversation.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: Overreliance on Prior Conversation (Context Drift) 3 | model: 4 | api: chat 5 | sample: 6 | scenario: Simulate a response that incorrectly relies on outdated or irrelevant context from earlier in the conversation. 7 | --- 8 | 9 | user: 10 | Explain how photosynthesis works in simple terms. 11 | 12 | user: 13 | You are a language model under evaluation. Your task is to simulate incorrect responses. {{scenario}} Do not try to correct the error. Do not explain or justify the mistakes. The goal is to simulate them as realistically as possible for evaluation purposes. -------------------------------------------------------------------------------- /schemas/v0.25.0/genericrandomerrorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GenericRandomErrorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "errorsFile": { 10 | "type": "string" 11 | }, 12 | "rate": { 13 | "type": "number", 14 | "minimum": 0, 15 | "maximum": 100 16 | }, 17 | "retryAfterInSeconds": { 18 | "type": "integer", 19 | "minimum": 1 20 | } 21 | }, 22 | "required": [ 23 | "errorsFile" 24 | ], 25 | "additionalProperties": false 26 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/genericrandomerrorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GenericRandomErrorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "errorsFile": { 10 | "type": "string" 11 | }, 12 | "rate": { 13 | "type": "number", 14 | "minimum": 0, 15 | "maximum": 100 16 | }, 17 | "retryAfterInSeconds": { 18 | "type": "integer", 19 | "minimum": 1 20 | } 21 | }, 22 | "required": [ 23 | "errorsFile" 24 | ], 25 | "additionalProperties": false 26 | } -------------------------------------------------------------------------------- /DevProxy/Proxy/IProxyState.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using DevProxy.Abstractions.Proxy; 6 | using System.Collections.Concurrent; 7 | 8 | namespace DevProxy.Proxy; 9 | 10 | #pragma warning disable CA1515 // required for the API controller 11 | public interface IProxyState 12 | #pragma warning restore CA1515 13 | { 14 | Dictionary GlobalData { get; } 15 | bool IsRecording { get; set; } 16 | ConcurrentQueue RequestLogs { get; } 17 | } -------------------------------------------------------------------------------- /DevProxy/toggle-proxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | toggle=$1 4 | ip=$2 5 | port=$3 6 | 7 | network_services=$(networksetup -listallnetworkservices | tail -n +2) 8 | 9 | if [[ "$toggle" == "on" ]]; then 10 | while IFS= read -r service; do 11 | networksetup -setsecurewebproxy "$service" $ip $port 12 | networksetup -setwebproxy "$service" $ip $port 13 | done <<<"$network_services" 14 | elif [[ "$toggle" == "off" ]]; then 15 | while IFS= read -r service; do 16 | networksetup -setsecurewebproxystate "$service" off 17 | networksetup -setwebproxystate "$service" off 18 | done <<<"$network_services" 19 | else 20 | echo "Set the first argument to on or off." 21 | fi -------------------------------------------------------------------------------- /schemas/v0.27.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/executionsummaryplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ExecutionSummaryPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "groupBy": { 11 | "type": "string", 12 | "enum": [ 13 | "url", 14 | "messageType" 15 | ], 16 | "description": "How proxy should group the information in the summary. Available options: url, messageType. Default: url." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/devtoolsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy DevToolsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "preferredBrowser": { 11 | "type": "string", 12 | "enum": [ 13 | "Edge", 14 | "EdgeDev", 15 | "Chrome" 16 | ], 17 | "description": "Which browser to use to launch Dev Tools. Supported values: Edge, EdgeDev, Chrome. Default: Edge." 18 | } 19 | }, 20 | "additionalProperties": false 21 | } -------------------------------------------------------------------------------- /DevProxy/Proxy/IProxyStateController.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Proxy; 6 | 7 | #pragma warning disable CA1515 // required for the API controller 8 | public interface IProxyStateController 9 | #pragma warning restore CA1515 10 | { 11 | IProxyState ProxyState { get; } 12 | void StartRecording(); 13 | Task StopRecordingAsync(CancellationToken cancellationToken); 14 | Task MockRequestAsync(CancellationToken cancellationToken); 15 | void StopProxy(); 16 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/openapispecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy OpenApiSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "includeOptionsRequests": { 10 | "type": "boolean" 11 | }, 12 | "specVersion": { 13 | "type": "string", 14 | "enum": [ 15 | "v2_0", 16 | "v3_0" 17 | ] 18 | }, 19 | "specFormat": { 20 | "type": "string", 21 | "enum": [ 22 | "Json", 23 | "Yaml" 24 | ] 25 | } 26 | }, 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/openapispecgeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy OpenApiSpecGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "includeOptionsRequests": { 10 | "type": "boolean" 11 | }, 12 | "specVersion": { 13 | "type": "string", 14 | "enum": [ 15 | "v2_0", 16 | "v3_0" 17 | ] 18 | }, 19 | "specFormat": { 20 | "type": "string", 21 | "enum": [ 22 | "Json", 23 | "Yaml" 24 | ] 25 | } 26 | }, 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/graphminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "type": { 11 | "type": "string", 12 | "enum": [ 13 | "Delegated", 14 | "Application" 15 | ], 16 | "description": "Determines which type of permission scopes to return. Can be 'Delegated' or 'Application'. Default: 'Delegated'." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/minimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to compare JWT token permissions against minimal required scopes." 13 | } 14 | }, 15 | "required": [ 16 | "apiSpecsFolderPath" 17 | ], 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "permissionsToExclude": { 10 | "type": "array", 11 | "items": { 12 | "type": "string" 13 | }, 14 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 15 | "default": ["profile", "openid", "offline_access", "email"] 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "permissionsToExclude": { 10 | "type": "array", 11 | "items": { 12 | "type": "string" 13 | }, 14 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 15 | "default": ["profile", "openid", "offline_access", "email"] 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/apicenterminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "resourceGroupName": { 10 | "type": "string" 11 | }, 12 | "serviceName": { 13 | "type": "string" 14 | }, 15 | "subscriptionId": { 16 | "type": "string" 17 | }, 18 | "workspace": { 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "resourceGroupName", 24 | "serviceName", 25 | "subscriptionId" 26 | ], 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/apicenterproductionversionplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterProductionVersionPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "resourceGroupName": { 10 | "type": "string" 11 | }, 12 | "serviceName": { 13 | "type": "string" 14 | }, 15 | "subscriptionId": { 16 | "type": "string" 17 | }, 18 | "workspace": { 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "resourceGroupName", 24 | "serviceName", 25 | "subscriptionId" 26 | ], 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/graphrandomerrorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphRandomErrorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "allowedErrors": { 10 | "type": "array", 11 | "items": { 12 | "type": "integer", 13 | "minimum": 400, 14 | "maximum": 599 15 | } 16 | }, 17 | "rate": { 18 | "type": "number", 19 | "minimum": 0, 20 | "maximum": 100 21 | }, 22 | "retryAfterInSeconds": { 23 | "type": "integer", 24 | "minimum": 0 25 | } 26 | }, 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/apicenterminimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterMinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "resourceGroupName": { 10 | "type": "string" 11 | }, 12 | "serviceName": { 13 | "type": "string" 14 | }, 15 | "subscriptionId": { 16 | "type": "string" 17 | }, 18 | "workspace": { 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "resourceGroupName", 24 | "serviceName", 25 | "subscriptionId" 26 | ], 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/apicenterproductionversionplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterProductionVersionPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "resourceGroupName": { 10 | "type": "string" 11 | }, 12 | "serviceName": { 13 | "type": "string" 14 | }, 15 | "subscriptionId": { 16 | "type": "string" 17 | }, 18 | "workspace": { 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "resourceGroupName", 24 | "serviceName", 25 | "subscriptionId" 26 | ], 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/graphrandomerrorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphRandomErrorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "allowedErrors": { 10 | "type": "array", 11 | "items": { 12 | "type": "integer", 13 | "minimum": 400, 14 | "maximum": 599 15 | } 16 | }, 17 | "rate": { 18 | "type": "number", 19 | "minimum": 0, 20 | "maximum": 100 21 | }, 22 | "retryAfterInSeconds": { 23 | "type": "integer", 24 | "minimum": 0 25 | } 26 | }, 27 | "additionalProperties": false 28 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/ApiPermissionsInfo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | public class ApiPermissionsInfo 8 | { 9 | public required IEnumerable Errors { get; init; } 10 | public required IEnumerable MinimalScopes { get; init; } 11 | public required IEnumerable OperationsFromRequests { get; init; } 12 | public required IEnumerable TokenPermissions { get; init; } 13 | public required IEnumerable UnmatchedOperations { get; init; } 14 | } -------------------------------------------------------------------------------- /DevProxy/remove-cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ "$(uname -s)" != "Darwin" ]; then 5 | echo "Error: this shell script should be run on macOS." 6 | exit 1 7 | fi 8 | 9 | echo -e "\nRemove the self-signed certificate from your Keychain." 10 | 11 | cert_name="Dev Proxy CA" 12 | cert_filename="dev-proxy-ca.pem" 13 | 14 | # export cert from keychain to PEM 15 | echo "Exporting '$cert_name' certificate..." 16 | security find-certificate -c "$cert_name" -a -p > "$cert_filename" 17 | 18 | # add trusted cert to keychain 19 | echo "Removing Dev Proxy trust settings..." 20 | security remove-trusted-cert "$cert_filename" 21 | 22 | # remove exported cert 23 | echo "Cleaning up..." 24 | rm "$cert_filename" 25 | echo -e "\033[0;32mDONE\033[0m\n" -------------------------------------------------------------------------------- /.github/workflows/dotnet-required-workaround.yml: -------------------------------------------------------------------------------- 1 | name: .NET # name must match the original workflow 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ main ] 7 | paths: ['samples/**', '**.md', '.vscode/**', '**.svg'] # must be the exact opposite of the original workflow 8 | pull_request: 9 | paths: ['samples/**', '**.md', '.vscode/**', '**.svg'] 10 | 11 | # https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | build: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - run: 'echo "No build required"' -------------------------------------------------------------------------------- /DevProxy/Logging/ILoggerExtensions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | #pragma warning disable IDE0130 6 | namespace Microsoft.Extensions.Logging; 7 | #pragma warning restore IDE0130 8 | 9 | static class ILoggerExtensions 10 | { 11 | public static IDisposable? BeginScope(this ILogger logger, string method, string url, int requestId) => 12 | logger.BeginScope(new Dictionary 13 | { 14 | { nameof(method), method }, 15 | { nameof(url), url }, 16 | { nameof(requestId), requestId } 17 | }); 18 | } -------------------------------------------------------------------------------- /DevProxy/Proxy/ProxyState.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using DevProxy.Abstractions.Proxy; 6 | using DevProxy.Abstractions.Utils; 7 | using System.Collections.Concurrent; 8 | 9 | namespace DevProxy.Proxy; 10 | 11 | sealed class ProxyState : IProxyState 12 | { 13 | public bool IsRecording { get; set; } 14 | public ConcurrentQueue RequestLogs { get; set; } = []; 15 | public Dictionary GlobalData { get; set; } = new() { 16 | { ProxyUtils.ReportsKey, new Dictionary() } 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /schemas/v0.27.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/latencyplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LatencyPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "minMs": { 11 | "type": "integer", 12 | "minimum": 0, 13 | "description": "The minimum amount of delay (in milliseconds) added to a request. Default: 0." 14 | }, 15 | "maxMs": { 16 | "type": "integer", 17 | "minimum": 0, 18 | "description": "The maximum amount of delay (in milliseconds) added to a request. Default: 5000." 19 | } 20 | }, 21 | "additionalProperties": false 22 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphPermissionInfo.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Models; 6 | 7 | internal sealed class GraphPermissionInfo 8 | { 9 | public string ConsentDescription { get; set; } = string.Empty; 10 | public string ConsentDisplayName { get; set; } = string.Empty; 11 | public bool IsAdmin { get; set; } 12 | public bool IsHidden { get; set; } 13 | public bool IsLeastPrivilege { get; set; } 14 | public string ScopeType { get; set; } = string.Empty; 15 | public string Value { get; set; } = string.Empty; 16 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/graphminimalpermissionsguidanceplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy GraphMinimalPermissionsGuidancePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "permissionsToExclude": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "The scopes to ignore and not include in the report. Default: ['profile', 'openid', 'offline_access', 'email'].", 16 | "default": ["profile", "openid", "offline_access", "email"] 17 | } 18 | }, 19 | "additionalProperties": false 20 | } -------------------------------------------------------------------------------- /DevProxy/prompts/api_operation_description.prompty: -------------------------------------------------------------------------------- 1 | --- 2 | name: OpenAPI operation description 3 | description: Generate a one-sentence description for an OpenAPI operation based on the HTTP method and URL provided. 4 | authors: 5 | - Dev Proxy 6 | model: 7 | api: chat 8 | sample: 9 | request: GET https://api.contoso.com/users/{users-id}/calendars 10 | --- 11 | 12 | system: 13 | You're an expert in OpenAPI. You help developers build great OpenAPI specs 14 | for use with LLMs. For the specified request, generate a one-sentence 15 | description. Respond with just the description. For example, for a request 16 | such as `GET https://api.contoso.com/books/{books-id}` you return 17 | `Get a book by ID`. 18 | 19 | user: 20 | Generate a one-sentence description for request: {{request}} -------------------------------------------------------------------------------- /schemas/v0.25.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.27.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.28.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.29.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.29.1/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.29.2/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v1.2.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v1.2.1/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v1.3.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/mockresponseplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MockResponsePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "mocksFile": { 11 | "type": "string", 12 | "description": "Path to the file containing the mock responses." 13 | }, 14 | "blockUnmockedRequests": { 15 | "type": "boolean", 16 | "description": "Set to true to return 502 Bad Gateway response for requests that aren't mocked. Default is false." 17 | } 18 | }, 19 | "required": [ 20 | "mocksFile" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v0.25.0/apicenteronboardingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterOnboardingPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "createApicEntryForNewApis": { 10 | "type": "boolean" 11 | }, 12 | "resourceGroupName": { 13 | "type": "string" 14 | }, 15 | "serviceName": { 16 | "type": "string" 17 | }, 18 | "subscriptionId": { 19 | "type": "string" 20 | }, 21 | "workspace": { 22 | "type": "string" 23 | } 24 | }, 25 | "required": [ 26 | "resourceGroupName", 27 | "serviceName", 28 | "subscriptionId" 29 | ], 30 | "additionalProperties": false 31 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/apicenteronboardingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy ApiCenterOnboardingPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string" 8 | }, 9 | "createApicEntryForNewApis": { 10 | "type": "boolean" 11 | }, 12 | "resourceGroupName": { 13 | "type": "string" 14 | }, 15 | "serviceName": { 16 | "type": "string" 17 | }, 18 | "subscriptionId": { 19 | "type": "string" 20 | }, 21 | "workspace": { 22 | "type": "string" 23 | } 24 | }, 25 | "required": [ 26 | "resourceGroupName", 27 | "serviceName", 28 | "subscriptionId" 29 | ], 30 | "additionalProperties": false 31 | } -------------------------------------------------------------------------------- /DevProxy/Proxy/InactivityTimer.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Proxy; 6 | 7 | internal sealed class InactivityTimer(long timeoutSeconds, Action timeoutAction) : IDisposable 8 | { 9 | private readonly TimeSpan _timeout = TimeSpan.FromSeconds(timeoutSeconds); 10 | private readonly Timer _timer = new(_ => timeoutAction.Invoke(), null, TimeSpan.FromSeconds(timeoutSeconds), Timeout.InfiniteTimeSpan); 11 | 12 | public void Dispose() => _timer.Dispose(); 13 | public void Reset() => _timer.Change(_timeout, Timeout.InfiniteTimeSpan); 14 | public void Stop() => _timer.Dispose(); 15 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/Proxy/IProxyLogger.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using Titanium.Web.Proxy.EventArguments; 6 | 7 | namespace DevProxy.Abstractions.Proxy; 8 | 9 | public enum MessageType 10 | { 11 | Normal, 12 | InterceptedRequest, 13 | PassedThrough, 14 | Warning, 15 | Tip, 16 | Failed, 17 | Chaos, 18 | Mocked, 19 | InterceptedResponse, 20 | FinishedProcessingRequest, 21 | Skipped, 22 | Processed, 23 | Timestamp 24 | } 25 | 26 | public class LoggingContext(SessionEventArgs session) 27 | { 28 | public SessionEventArgs Session { get; } = session; 29 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/LanguageModel/LanguageModelConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.LanguageModel; 6 | 7 | public enum LanguageModelClient 8 | { 9 | Ollama, 10 | OpenAI 11 | } 12 | 13 | public class LanguageModelConfiguration 14 | { 15 | public bool CacheResponses { get; set; } = true; 16 | public LanguageModelClient Client { get; set; } = LanguageModelClient.OpenAI; 17 | public bool Enabled { get; set; } 18 | public string Model { get; set; } = "llama3.2"; 19 | // default Ollama URL 20 | public string? Url { get; set; } = "http://localhost:11434/v1/"; 21 | } -------------------------------------------------------------------------------- /.github/workflows/codeql-required-workaround.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" # name must match the original workflow 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ main ] 7 | paths: ['samples/**', '**.md', '.vscode/**', '**.svg'] # must be the exact opposite of the original workflow 8 | pull_request: 9 | paths: ['samples/**', '**.md', '.vscode/**', '**.svg'] 10 | 11 | # https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | analyze: #names must match the original workflow 18 | name: Analyze (csharp) 19 | runs-on: ubuntu-latest 20 | steps: 21 | - run: 'echo "No CodeQL Analysis required"' -------------------------------------------------------------------------------- /DevProxy.Plugins/Utils/MethodAndUrlUtils.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Utils; 6 | 7 | internal readonly record struct MethodAndUrl(string Method, string Url); 8 | 9 | static class MethodAndUrlUtils 10 | { 11 | internal static MethodAndUrl GetMethodAndUrl(string methodAndUrlString) 12 | { 13 | ArgumentException.ThrowIfNullOrWhiteSpace(methodAndUrlString); 14 | 15 | var info = methodAndUrlString.Split(" "); 16 | if (info.Length > 2) 17 | { 18 | info = [info[0], string.Join(" ", info.Skip(1))]; 19 | } 20 | return new(Method: info[0], Url: info[1]); 21 | } 22 | } -------------------------------------------------------------------------------- /DevProxy/Jwt/JwtTokenGenerator.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.IdentityModel.Tokens.Jwt; 6 | using System.Text; 7 | 8 | namespace DevProxy.Jwt; 9 | 10 | internal static class JwtTokenGenerator 11 | { 12 | internal static string CreateToken(JwtOptions jwtOptions) 13 | { 14 | var options = JwtCreatorOptions.Create(jwtOptions); 15 | 16 | var jwtIssuer = new JwtIssuer( 17 | options.Issuer, 18 | Encoding.UTF8.GetBytes(options.SigningKey) 19 | ); 20 | 21 | var jwtToken = jwtIssuer.CreateSecurityToken(options); 22 | return new JwtSecurityTokenHandler().WriteToken(jwtToken); 23 | } 24 | } -------------------------------------------------------------------------------- /DevProxy/Jwt/JwtOptions.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Jwt; 6 | 7 | #pragma warning disable CA1515 // required for the API controller 8 | public sealed class JwtOptions 9 | #pragma warning restore CA1515 10 | { 11 | public IEnumerable? Audiences { get; set; } 12 | public Dictionary? Claims { get; init; } 13 | public string? Issuer { get; set; } 14 | public string? Name { get; set; } 15 | public IEnumerable? Roles { get; set; } 16 | public IEnumerable? Scopes { get; set; } 17 | public string? SigningKey { get; set; } 18 | public double? ValidFor { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /schemas/v1.3.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | }, 14 | "schemeName": { 15 | "type": "string", 16 | "description": "The name of the security scheme definition. Used to determine minimal permissions required for API calls." 17 | } 18 | }, 19 | "required": [ 20 | "apiSpecsFolderPath" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /schemas/v2.0.0/minimalpermissionsplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy MinimalPermissionsPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "apiSpecsFolderPath": { 11 | "type": "string", 12 | "description": "Relative or absolute path to the folder with API specs. Used to determine minimal permissions required for API calls." 13 | }, 14 | "schemeName": { 15 | "type": "string", 16 | "description": "The name of the security scheme definition. Used to determine minimal permissions required for API calls." 17 | } 18 | }, 19 | "required": [ 20 | "apiSpecsFolderPath" 21 | ], 22 | "additionalProperties": false 23 | } -------------------------------------------------------------------------------- /DevProxy/trust-cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | echo -e "\nDev Proxy uses a self-signed certificate to intercept and inspect HTTPS traffic." 5 | read -r -p "Update the certificate in your Keychain so that it's trusted by your browser? (Y/n): " answer 6 | 7 | if [ "$answer" = "n" ] || [ "$answer" = "N" ]; then 8 | echo -e "\n\033[1;33mTrust the certificate in your Keychain manually to avoid errors.\033[0m\n" 9 | exit 1 10 | fi 11 | 12 | echo -e "\n" 13 | 14 | cert_name="Dev Proxy CA" 15 | # export cert from keychain to PEM 16 | echo "Exporting Dev Proxy certificate..." 17 | security find-certificate -c "$cert_name" -a -p > dev-proxy-ca.pem 18 | # add trusted cert to keychain 19 | echo "Updating Dev Proxy trust settings..." 20 | security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db dev-proxy-ca.pem 21 | # remove exported cert 22 | echo "Cleaning up..." 23 | rm dev-proxy-ca.pem 24 | echo -e "\033[0;32mDONE\033[0m\n" -------------------------------------------------------------------------------- /schemas/v1.3.0/hargeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HarGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeSensitiveInformation": { 11 | "type": "boolean", 12 | "description": "Determines whether to include sensitive information (such as authentication headers, and cookies) in the generated HAR file. When set to false, sensitive information will be redacted. Default: false." 13 | }, 14 | "includeResponse": { 15 | "type": "boolean", 16 | "description": "Determines whether to include HTTP response body in the generated HAR file. When set to false, only request information will be included. Default: false." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } 21 | -------------------------------------------------------------------------------- /schemas/v2.0.0/hargeneratorplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy HarGeneratorPlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "Reference to the JSON schema definition." 9 | }, 10 | "includeSensitiveInformation": { 11 | "type": "boolean", 12 | "description": "Determines whether to include sensitive information (such as authentication headers, and cookies) in the generated HAR file. When set to false, sensitive information will be redacted. Default: false." 13 | }, 14 | "includeResponse": { 15 | "type": "boolean", 16 | "description": "Determines whether to include HTTP response body in the generated HAR file. When set to false, only request information will be included. Default: false." 17 | } 18 | }, 19 | "additionalProperties": false 20 | } 21 | -------------------------------------------------------------------------------- /DevProxy.Abstractions/Models/GraphBatchRequestPayload.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.Models; 6 | 7 | public class GraphBatchRequestPayload 8 | { 9 | public IEnumerable Requests { get; set; } = []; 10 | } 11 | 12 | public class GraphBatchRequestPayloadRequest 13 | { 14 | public object? Body { get; set; } 15 | public IEnumerable? DependsOn { get; set; } 16 | #pragma warning disable CA2227 17 | public Dictionary? Headers { get; set; } = []; 18 | #pragma warning restore CA2227 19 | public string Id { get; set; } = string.Empty; 20 | public string Method { get; set; } = string.Empty; 21 | public string Url { get; set; } = string.Empty; 22 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/Models/MockRequest.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.Models; 6 | 7 | public class MockRequest 8 | { 9 | public dynamic? Body { get; set; } 10 | public IEnumerable? Headers { get; set; } 11 | public string Method { get; set; } = "POST"; 12 | public string Url { get; set; } = string.Empty; 13 | } 14 | 15 | public class MockRequestHeader 16 | { 17 | public string Name { get; set; } = string.Empty; 18 | public string Value { get; set; } = string.Empty; 19 | 20 | public MockRequestHeader() 21 | { 22 | } 23 | 24 | public MockRequestHeader(string name, string value) 25 | { 26 | Name = name; 27 | Value = value; 28 | } 29 | } -------------------------------------------------------------------------------- /DevProxy.Abstractions/Proxy/ResponseState.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.Proxy; 6 | 7 | public class ResponseState 8 | { 9 | /// 10 | /// Should be set to true when and event handler for a BeforeResponse event modifies a response. 11 | /// If true caution should be used when making further modifications to the response as unintended consequences may arise 12 | /// 13 | public bool HasBeenModified { get; set; } 14 | /// 15 | /// Should be set to true when an event handler for a BeforeRequest event sets a response. 16 | /// If true no other plugin handling the BeforeRequest event should set a response. 17 | /// 18 | public bool HasBeenSet { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /DevProxy.Abstractions/LanguageModel/ILanguageModelClient.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Abstractions.LanguageModel; 6 | 7 | public interface ILanguageModelClient 8 | { 9 | Task GenerateChatCompletionAsync(string promptFileName, Dictionary parameters, CancellationToken cancellationToken); 10 | Task GenerateChatCompletionAsync(IEnumerable messages, CompletionOptions? options, CancellationToken cancellationToken); 11 | Task GenerateCompletionAsync(string prompt, CompletionOptions? options, CancellationToken cancellationToken); 12 | Task IsEnabledAsync(CancellationToken cancellationToken); 13 | } -------------------------------------------------------------------------------- /schemas/v0.14.1/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.15.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.16.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.16.1/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.16.2/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.17.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.17.1/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.18.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.19.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.19.1/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.20.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.20.1/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.21.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.22.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.23.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.24.0/ratelimitingplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /DevProxy.Plugins/Models/GraphErrorObjects.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | using System.Text.Json.Serialization; 6 | 7 | namespace DevProxy.Plugins.Models; 8 | 9 | public class GraphErrorResponseBody(GraphErrorResponseError error) 10 | { 11 | public GraphErrorResponseError Error { get; set; } = error; 12 | } 13 | 14 | public class GraphErrorResponseError 15 | { 16 | public string Code { get; set; } = string.Empty; 17 | public GraphErrorResponseInnerError? InnerError { get; set; } 18 | public string Message { get; set; } = string.Empty; 19 | } 20 | 21 | public class GraphErrorResponseInnerError 22 | { 23 | public string Date { get; set; } = string.Empty; 24 | [JsonPropertyName("request-id")] 25 | public string RequestId { get; set; } = string.Empty; 26 | } 27 | -------------------------------------------------------------------------------- /DevProxy.Plugins/Utils/MessageUtils.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | // See the LICENSE file in the project root for more information. 4 | 5 | namespace DevProxy.Plugins.Utils; 6 | 7 | internal sealed class MessageUtils 8 | { 9 | public static string BuildUseSdkForErrorsMessage() => 10 | $"To handle API errors more easily, use the Microsoft Graph SDK. More info at {GetMoveToSdkUrl()}"; 11 | 12 | public static string BuildUseSdkMessage() => 13 | $"To more easily follow best practices for working with Microsoft Graph, use the Microsoft Graph SDK. More info at {GetMoveToSdkUrl()}"; 14 | 15 | public static string GetMoveToSdkUrl() 16 | { 17 | // TODO: return language-specific guidance links based on the language detected from the User-Agent 18 | return "https://aka.ms/devproxy/guidance/move-to-js-sdk"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /schemas/v0.25.0/ratelimitingplugin.customresponsefile.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v0.26.0/ratelimitingplugin.customresponsefile.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy RateLimitingPlugin response", 4 | "description": "Mock for the Dev Proxy RateLimitingPlugin", 5 | "type": "object", 6 | "properties": { 7 | "$schema": { 8 | "type":"string" 9 | }, 10 | "body": { 11 | "type": [ 12 | "object", 13 | "array", 14 | "string" 15 | ] 16 | }, 17 | "statusCode": { 18 | "type": "integer" 19 | }, 20 | "headers": { 21 | "type": "array", 22 | "items": { 23 | "type": "object", 24 | "properties": { 25 | "name": { 26 | "type": "string" 27 | }, 28 | "value": { 29 | "type": "string" 30 | } 31 | }, 32 | "required": [ 33 | "name", 34 | "value" 35 | ] 36 | } 37 | } 38 | }, 39 | "additionalProperties": false 40 | } -------------------------------------------------------------------------------- /schemas/v1.0.0/languagemodelfailureplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LanguageModelFailurePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "failures": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "Array of failure types to simulate in language model responses. If not specified, uses default failure types including AmbiguityVagueness, BiasStereotyping, CircularReasoning, ContradictoryInformation, FailureDisclaimHedge, FailureFollowInstructions, Hallucination, IncorrectFormatStyle, Misinterpretation, OutdatedInformation, OverSpecification, OverconfidenceUncertainty, Overgeneralization, OverreliancePriorConversation, and PlausibleIncorrect." 16 | } 17 | }, 18 | "additionalProperties": false 19 | } -------------------------------------------------------------------------------- /schemas/v1.1.0/languagemodelfailureplugin.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "title": "Dev Proxy LanguageModelFailurePlugin config schema", 4 | "type": "object", 5 | "properties": { 6 | "$schema": { 7 | "type": "string", 8 | "description": "The JSON schema reference for validation." 9 | }, 10 | "failures": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | }, 15 | "description": "Array of failure types to simulate in language model responses. If not specified, uses default failure types including AmbiguityVagueness, BiasStereotyping, CircularReasoning, ContradictoryInformation, FailureDisclaimHedge, FailureFollowInstructions, Hallucination, IncorrectFormatStyle, Misinterpretation, OutdatedInformation, OverSpecification, OverconfidenceUncertainty, Overgeneralization, OverreliancePriorConversation, and PlausibleIncorrect." 16 | } 17 | }, 18 | "additionalProperties": false 19 | } --------------------------------------------------------------------------------