From 12362fb986c7d0a637548e3bbf2f4eb4d526da86 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Tue, 18 Jul 2023 16:51:07 +0000 Subject: [PATCH] ProfileInfo: Add offSchema property to known and missing args Signed-off-by: Amber Torrise Co-authored-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> Signed-off-by: Amber Torrise --- packages/config/src/ProfileInfo.ts | 9 +++++++-- packages/config/src/doc/IProfArgAttrs.ts | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/config/src/ProfileInfo.ts b/packages/config/src/ProfileInfo.ts index f663b512b..5b31b37d3 100644 --- a/packages/config/src/ProfileInfo.ts +++ b/packages/config/src/ProfileInfo.ts @@ -623,7 +623,8 @@ export class ProfileInfo { dataType: this.argDataType(typeof propVal), // TODO Is using `typeof` bad for "null" values that may be int or bool? argValue: propVal, argLoc, - secure + secure, + offSchema: true }); } } @@ -654,7 +655,8 @@ export class ProfileInfo { dataType: this.argDataType(typeof propVal), argValue: propVal, argLoc, - secure + secure, + offSchema: true }); } } @@ -746,6 +748,7 @@ export class ProfileInfo { dataType: this.argDataType(propInfoInSchema.type), argValue: (propInfoInSchema as ICommandProfileProperty).optionDefinition?.defaultValue, argLoc, + offSchema: false, // See https://github.com/zowe/imperative/issues/739 secure: foundInSecureArray || propInfoInSchema.secure }; @@ -760,6 +763,7 @@ export class ProfileInfo { if (!argFound) { mergedArgs.missingArgs.push({ argName: propName, + offSchema: false, dataType: this.argDataType(propInfoInSchema.type), argValue: (propInfoInSchema as ICommandProfileProperty).optionDefinition?.defaultValue, argLoc: { locType: ProfLocType.DEFAULT }, @@ -767,6 +771,7 @@ export class ProfileInfo { }); } } else { + knownArg.offSchema = false; knownArg.secure = knownArg.secure ?? propInfoInSchema.secure; if (knownArg.secure) { delete knownArg.argValue; diff --git a/packages/config/src/doc/IProfArgAttrs.ts b/packages/config/src/doc/IProfArgAttrs.ts index f227b2bed..370dda3d4 100644 --- a/packages/config/src/doc/IProfArgAttrs.ts +++ b/packages/config/src/doc/IProfArgAttrs.ts @@ -35,4 +35,7 @@ export interface IProfArgAttrs { /** Whether the argument value is stored securely */ secure?: boolean; + + /** Whether the argument value is defined in the schema file */ + offSchema?: boolean; }