From ea2e0aa3eac54865619c7400212eecb6d10f7a9d Mon Sep 17 00:00:00 2001 From: Changlong Liu Date: Wed, 29 Jul 2020 10:07:55 +0800 Subject: [PATCH] check request.parameters exists --- src/plugins/aznamer.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plugins/aznamer.ts b/src/plugins/aznamer.ts index 9cec8da32..df5d6ce33 100644 --- a/src/plugins/aznamer.ts +++ b/src/plugins/aznamer.ts @@ -209,17 +209,19 @@ export class AzNamer { } }); operation.extensions['cli-split-operation-original-operation'].requests.forEach(request => { - request.parameters.forEach(parameter => { - if(!isNullOrUndefined(parameter.language['az'])) { - if(operation.language['az'].command.endsWith(' update') && parameter['flattened'] != true) { - let paramType = parameter.schema.type; - if(paramType == SchemaType.Any || paramType == SchemaType.Array || paramType == SchemaType.Object || paramType == SchemaType.Dictionary) { - param = parameter; - listCnt++; + if (request.parameters) { + request.parameters.forEach(parameter => { + if(!isNullOrUndefined(parameter.language['az'])) { + if(operation.language['az'].command.endsWith(' update') && parameter['flattened'] != true) { + let paramType = parameter.schema.type; + if(paramType == SchemaType.Any || paramType == SchemaType.Array || paramType == SchemaType.Object || paramType == SchemaType.Dictionary) { + param = parameter; + listCnt++; + } } } - } - }); + }); + }; }) if(listCnt == 1) { operation.extensions['cli-split-operation-original-operation']['genericSetterParam'] = param;