Skip to content

Commit

Permalink
feat: add portkey-default value check to set default param values
Browse files Browse the repository at this point in the history
  • Loading branch information
VisargD committed Mar 16, 2024
1 parent a74717e commit 65aecf3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/services/transformToProviderRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ const transformToProviderRequest = (provider: string, params: Params, fn: string
value = paramConfig.transform(params);
}

if (
value === "portkey-default" &&
paramConfig &&
paramConfig.default !== undefined
) {
// Set the transformed parameter to the default value
setNestedProperty(
transformedRequest,
paramConfig.param,
paramConfig.default
);
}

// If a minimum is defined for this parameter and the value is less than this, set the value to the minimum
// Also, we should only do this comparison if value is of type 'number'
if (
Expand Down

0 comments on commit 65aecf3

Please sign in to comment.