Skip to content

Commit b29599c

Browse files
committed
feat: Removed null from AJV validation checks. Null will pass as empty even when the schema doesn't explicitly allow nulls
1 parent 7735a9e commit b29599c

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

package-lock.json

Lines changed: 31 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-lib",
3-
"version": "1.0.174",
3+
"version": "1.0.175",
44
"description": "Library plugin library",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -22,7 +22,8 @@
2222
"uuid": "^10.0.0",
2323
"lodash.isequal": "^4.5.0",
2424
"nanoid": "^5.0.9",
25-
"strip-ansi": "^7.1.0"
25+
"strip-ansi": "^7.1.0",
26+
"clean-deep": "^3.4.0"
2627
},
2728
"devDependencies": {
2829
"@oclif/prettier-config": "^0.2.1",

src/resource/resource-controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Ajv, ValidateFunction } from 'ajv';
2+
import cleanDeep from 'clean-deep';
23
import {
34
ParameterOperation,
45
ResourceConfig,
@@ -63,7 +64,10 @@ export class ResourceController<T extends StringIndexedObject> {
6364

6465
if (this.schemaValidator) {
6566
// Schema validator uses pre transformation parameters
66-
const isValid = this.schemaValidator(originalParameters);
67+
const isValid = this.schemaValidator(
68+
// @ts-expect-error Non esm package
69+
cleanDeep(originalParameters, { nullValues: true })
70+
);
6771

6872
if (!isValid) {
6973
return {

0 commit comments

Comments
 (0)