Skip to content

Commit

Permalink
Adjusted getMetadata helper to remove unset fields
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenHoeffler committed Feb 23, 2024
1 parent 506f128 commit 820ff79
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions templates/lib/utils/helpers.js
Expand Up @@ -32,8 +32,7 @@ const executeSwaggerCall = async function (callParams) {
error.status !== 422
) {
this.logger.info(
`Received response status: ${error.status}. Attempt #${currentAttempt}. Retrying in ${
operation._originalTimeouts[currentAttempt - 1]
`Received response status: ${error.status}. Attempt #${currentAttempt}. Retrying in ${operation._originalTimeouts[currentAttempt - 1]
} ms...`
);
return;
Expand Down Expand Up @@ -158,10 +157,8 @@ function getMetadata(metadata) {
const metadataKeys = ["oihUid", "recordUid", "applicationUid"];
let newMetadata = {};
for (let i = 0; i < metadataKeys.length; i++) {
newMetadata[metadataKeys[i]] =
metadata !== undefined && metadata[metadataKeys[i]] !== undefined
? metadata[metadataKeys[i]]
: `${metadataKeys[i]} not set yet`;
if (metadataKeys[i] in metadata && metadata[metadataKeys[i]])
newMetadata[metadataKeys[i]] = metadata[metadataKeys[i]];
}
return newMetadata;
}
Expand Down

0 comments on commit 820ff79

Please sign in to comment.