From 8f84e811f00e73faeec8d2d4b1a02f69eb374175 Mon Sep 17 00:00:00 2001 From: Antoine Mulet Date: Thu, 18 Jun 2020 20:50:40 +0200 Subject: [PATCH] fix: make empty params default to '{}' for methods with explicit by-name param structure in Inspector --- src/plugins/InspectorPlugin.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/InspectorPlugin.tsx b/src/plugins/InspectorPlugin.tsx index 115648a2..0727ffbc 100644 --- a/src/plugins/InspectorPlugin.tsx +++ b/src/plugins/InspectorPlugin.tsx @@ -14,6 +14,7 @@ const InspectorPlugin: React.FC = (props) => { const examplePosition = 0; let example; let exampleParams: any; + let emptyParams = [] as any; if (method && method.examples && method.examples[examplePosition]) { example = method.examples[examplePosition] as ExamplePairingObject; const paramStructure: TParamStructure = method.paramStructure || "either"; @@ -24,6 +25,9 @@ const InspectorPlugin: React.FC = (props) => { }), {} as any) : (example.params as ExampleObject[]).map(((p) => p.value)); } + if (method && method.paramStructure === "by-name") { + emptyParams = {}; + } return ( @@ -42,5 +46,3 @@ const InspectorPlugin: React.FC = (props) => { }; export default InspectorPlugin; - -