Skip to content

[BUG]: "Sequence contains no elements" error while generating an OpenAPI spec #509

@waldekmastykarz

Description

@waldekmastykarz

Description

When you generate an OpenAPI spec, sometimes it shows the Error processing request GET https://jsonplaceholder.typicode.com/posts/2: Sequence contains no elements error.

Expected behaviour

No error

Actual behaviour

Error

Steps to reproduce

Generate an OpenAPI spec for API that returns responses without body

Dev Proxy Version

latest from main

Operating system (environment)

macOS

Shell

zsh

Configuration file

{
  "$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v1.0/rc.schema.json",
  "plugins": [
    {
      "name": "OpenApiSpecGeneratorPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
    }
  ],
  "urlsToWatch": [
    "https://jsonplaceholder.typicode.com/*"
  ]
}

Additional Info

   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at Microsoft.DevProxy.Plugins.RequestLogs.OpenApiSpecGeneratorPlugin.AddOrMergeResponse(OpenApiOperation operation, OpenApiResponses apiResponses) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy-plugins/RequestLogs/OpenApiSpecGeneratorPlugin.cs:line 804
   at Microsoft.DevProxy.Plugins.RequestLogs.OpenApiSpecGeneratorPlugin.AddOrMergeOperation(OpenApiPathItem pathItem, OperationType operationType, OpenApiOperation apiOperation) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy-plugins/RequestLogs/OpenApiSpecGeneratorPlugin.cs:line 681
   at Microsoft.DevProxy.Plugins.RequestLogs.OpenApiSpecGeneratorPlugin.AddOrMergePathItem(IList`1 openApiDocs, OpenApiPathItem pathItem, Uri requestUri, String parametrizedPath) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy-plugins/RequestLogs/OpenApiSpecGeneratorPlugin.cs:line 661
   at Microsoft.DevProxy.Plugins.RequestLogs.OpenApiSpecGeneratorPlugin.AfterRecordingStop(Object sender, RecordingArgs e) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy-plugins/RequestLogs/OpenApiSpecGeneratorPlugin.cs:line 307

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions