Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
add default value for argument which is not in parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kairu-ms committed Aug 6, 2021
1 parent 2eda934 commit 6c9dfb5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/generate/renders/generated/CliCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,24 @@ function GetSingleCommandBody(model: CodeModelAz, required: any) {
}
continue;
}
} else if (
methodParameterHandler.MethodParameter_DefaultValue !== undefined &&
methodParameterHandler.MethodParameter_Type !== SchemaType.Constant &&
!isNullOrUndefined(methodParameterHandler.MethodParameter_NamePython)
) {
// model is simple type with default value
outputBody.push(
' if ' + methodParameterHandler.MethodParameter_MapsTo + ' is None:',
);
outputBody.push(
' ' +
methodParameterHandler.MethodParameter_MapsTo +
' = ' +
ToPythonString(
methodParameterHandler.MethodParameter_DefaultValue,
methodParameterHandler.MethodParameter_Type,
),
);
}
} while (skip || model.SelectNextMethodParameter());
}
Expand Down

0 comments on commit 6c9dfb5

Please sign in to comment.