42Crunch/vscode-openapi

Error generating code from response

kenrobbins opened this issue · 2 comments

When I click "Generate schema", nothing happens and I see this in the console. I don't really understand what's going on.

Version: 1.76.0 (Universal)
Commit: 92da9481c0904c6adfe372c12da3b7748d74bdcb
Date: 2023-03-01T10:23:45.993Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin x64 22.2.0
Sandboxed: No

index.js:624  action oas/createSchema @ 13:02:00.913
index.js:624  prev state {theme: {…}, tryit: {…}, scan: {…}, route: {…}, env: {…}, …}
index.js:624  action     {type: 'oas/createSchema', payload: {…}}
index.js:624  next state {theme: {…}, tryit: {…}, scan: {…}, route: {…}, env: {…}, …}
console.ts:137 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot convert undefined or null to object
T @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:718
deliver @ event.ts:926
fire @ event.ts:887
fire @ ipc.net.ts:671
ne.onmessage @ localProcessExtensionHost.ts:615
console.ts:137 [Extension Host] stack trace: TypeError: Cannot convert undefined or null to object
	at Function.keys (<anonymous>)
	at /Users/kenneth/.vscode/extensions/42crunch.vscode-openapi-4.15.16/out/tryit/create-schema-handler.js:54:44
	at Generator.next (<anonymous>)
	at fulfilled (/Users/kenneth/.vscode/extensions/42crunch.vscode-openapi-4.15.16/out/tryit/create-schema-handler.js:32:58)
T @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:718
deliver @ event.ts:926
fire @ event.ts:887
fire @ ipc.net.ts:671
ne.onmessage @ localProcessExtensionHost.ts:615
mainThreadExtensionService.ts:79 [[object Object]]Cannot convert undefined or null to object
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:718
deliver @ event.ts:926
fire @ event.ts:887
fire @ ipc.net.ts:671
ne.onmessage @ localProcessExtensionHost.ts:615
mainThreadExtensionService.ts:80 TypeError: Cannot convert undefined or null to object
	at Function.keys (<anonymous>)
	at vscode-file://vscode-app/Users/kenneth/.vscode/extensions/42crunch.vscode-openapi-4.15.16/out/tryit/create-schema-handler.js:54:44
	at Generator.next (<anonymous>)
	at fulfilled (vscode-file://vscode-app/Users/kenneth/.vscode/extensions/42crunch.vscode-openapi-4.15.16/out/tryit/create-schema-handler.js:32:58)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:80
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:718
deliver @ event.ts:926
fire @ event.ts:887
fire @ ipc.net.ts:671
ne.onmessage @ localProcessExtensionHost.ts:615

Thanks for the report! We have an issue with 'Generate schema' using response contents - it will fail if you don't already have "components" / "schemas" nodes for OpenAPI v3 or "definitions" node for V2 in your document.

The fix for this issue will be available in the next update of the plugin, which is expected in a week or so.

This should be fixed in now released 4.16.0