Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add new validateParams function #180

Merged
merged 1 commit into from
Dec 6, 2021
Merged

fix: add new validateParams function #180

merged 1 commit into from
Dec 6, 2021

Conversation

padamstx
Copy link
Member

@padamstx padamstx commented Dec 5, 2021

This commit adds the "validateParams" function
to the node core. This function will be used
by the operation code generated by the Node
SDK generator to validate the parameters found
within a "params" object. It will check for
required parameters that are not present, and also
check to make sure that all parameters that ARE present
are valid (i.e. the param name is among the expected
valid parameter names for the operation).

Checklist
  • npm test passes (tip: npm run lint-fix can correct most style issues)
  • tests are included
  • documentation is changed or added

@padamstx padamstx requested a review from dpopp07 December 5, 2021 16:21
@padamstx padamstx self-assigned this Dec 5, 2021
This commit adds the "validateParams" function
to the node core.  This function will be used
by the operation code generated by the Node
SDK generator to validate the parameters found
within a "params" object.  It will check for
required parameters that are not present, and also
check to make sure that all parameters that ARE present
are valid (i.e. the param name is among the expected
valid parameter names for the operation).
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍


it('should return null if params is an empty object and requiredParams and allParams are null', () => {
expect(validateParams({}, null, null)).toBeNull();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So thorough with the null/undefined/empty checks! 😄

@padamstx padamstx merged commit 514d187 into main Dec 6, 2021
@padamstx padamstx deleted the valdate-params branch December 6, 2021 20:35
ibm-devx-sdk pushed a commit that referenced this pull request Dec 6, 2021
## [2.17.1](v2.17.0...v2.17.1) (2021-12-06)

### Bug Fixes

* add new validateParams function ([#180](#180)) ([514d187](514d187))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 2.17.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

JurajNyiri pushed a commit to JurajNyiri/node-sdk-core that referenced this pull request Aug 22, 2024
Generated SDK source code using:
- Generator version 3.26.0
- Specification version 1.0.0-dev0.0.31
- Automation (cloudant-sdks) version 30a5893
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants