Skip to content

Commit 75194bb

Browse files
committed
Add IgnoreResponseTypes option to OpenApiSpecGeneratorPlugin
1 parent 5a41e4d commit 75194bb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

DevProxy.Plugins/Generation/OpenApiSpecGeneratorPlugin.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public sealed class OpenApiSpecGeneratorPluginConfiguration
5555
public bool IncludeOptionsRequests { get; set; }
5656
public SpecFormat SpecFormat { get; set; } = SpecFormat.Json;
5757
public SpecVersion SpecVersion { get; set; } = SpecVersion.v3_0;
58+
public bool IgnoreResponseTypes { get; set; }
5859
}
5960

6061
public sealed class OpenApiSpecGeneratorPlugin(
@@ -416,6 +417,15 @@ private void SetResponseFromSession(OpenApiOperation operation, Response respons
416417
if (contentType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase))
417418
{
418419
Logger.LogDebug(" Processing JSON body...");
420+
if (Configuration.IgnoreResponseTypes)
421+
{
422+
Logger.LogDebug(" Ignoring response types");
423+
return new()
424+
{
425+
Type = "string",
426+
};
427+
}
428+
419429
return GetSchemaFromJsonString(body);
420430
}
421431

schemas/v0.29.0/openapispecgeneratorplugin.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"type": "boolean",
1212
"description": "Determines whether to include OPTIONS requests in the generated OpenAPI spec. Default: false."
1313
},
14+
"ignoreResponseTypes": {
15+
"type": "boolean",
16+
"description": "Determines whether to ignore response types in the generated OpenAPI spec. Default: false."
17+
},
1418
"specVersion": {
1519
"type": "string",
1620
"enum": [

0 commit comments

Comments
 (0)