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

Commit

Permalink
ProfileInfo: Add offSchema property to known and missing args
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <amber.torrise@broadcom.com>
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 <at895452@broadcom.net>
  • Loading branch information
zFernand0 authored and Amber Torrise committed Jul 18, 2023
1 parent c2996e4 commit 12362fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/config/src/ProfileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
}
Expand Down Expand Up @@ -654,7 +655,8 @@ export class ProfileInfo {
dataType: this.argDataType(typeof propVal),
argValue: propVal,
argLoc,
secure
secure,
offSchema: true
});
}
}
Expand Down Expand Up @@ -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
};
Expand All @@ -760,13 +763,15 @@ 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 },
secure: propInfoInSchema.secure
});
}
} else {
knownArg.offSchema = false;
knownArg.secure = knownArg.secure ?? propInfoInSchema.secure;
if (knownArg.secure) {
delete knownArg.argValue;
Expand Down
3 changes: 3 additions & 0 deletions packages/config/src/doc/IProfArgAttrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 12362fb

Please sign in to comment.