ibm-cloud-sdk-core
Version:
Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.
90 lines (43 loc) • 1.48 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md) > [validateParams](./ibm-cloud-sdk-core.validateparams.md)
## validateParams() function
Validates that "params" contains a value for each key listed in "requiredParams", and that each key contained in "params" is a valid key listed in "allParams". In essence, we want params to contain only valid keys and we want params to contain at least the required keys.
**Signature:**
```typescript
export declare function validateParams(params: {
[key: string]: any;
}, requiredParams: string[], allParams: string[]): null | Error;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
params
</td><td>
{ \[key: string\]: any; }
</td><td>
the "params" object passed into an operation containing method parameters.
</td></tr>
<tr><td>
requiredParams
</td><td>
string\[\]
</td><td>
the names of required parameters. If null, then the "required params" check is bypassed.
</td></tr>
<tr><td>
allParams
</td><td>
string\[\]
</td><td>
the names of all valid parameters. If null, then the "valid params" check is bypassed.
</td></tr>
</tbody></table>
**Returns:**
null \| Error
null if no errors found, otherwise an Error instance