Skip to content

Commit d089bca

Browse files
authored
Merge pull request #572 from devtron-labs/fix/rjsf-form-validations
fix: use SCHEMA_07_VALIDATOR instead of SCHEMA_07_VALIDATOR_STRICT in rjsf
2 parents a5b5162 + 38edab1 commit d089bca

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

package-lock.json

Lines changed: 2 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.6.13",
3+
"version": "1.6.14",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/RJSF/Form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import RJSF from '@rjsf/core'
2020
import { templates, widgets } from './config'
2121
import { FormProps } from './types'
2222
import { translateString } from './utils'
23-
import { SCHEMA_07_VALIDATOR_STRICT } from '@Shared/validations'
23+
import { SCHEMA_07_VALIDATOR } from '@Shared/validations'
2424
import './rjsfForm.scss'
2525

2626
// Need to use this way because the default import was not working as expected
2727
// The default import resolves to an object intead of a function
2828
const Form = RJSF
29-
const validator = SCHEMA_07_VALIDATOR_STRICT
29+
const validator = SCHEMA_07_VALIDATOR
3030

3131
export const RJSFForm = forwardRef((props: FormProps, ref: FormProps['ref']) => (
3232
<Form

src/Shared/validations.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,10 @@ SCHEMA_07_VALIDATOR_STRICT.ajv.addKeyword('hidden')
389389
SCHEMA_07_VALIDATOR_STRICT.ajv.addFormat('memory', /^\d+(\.\d+)?(Ki|Mi|Gi|Ti|Pi|Ei|KiB|MiB|GiB|TiB|PiB|EiB)?$/)
390390
SCHEMA_07_VALIDATOR_STRICT.ajv.addFormat('cpu', /^(?:\d+(\.\d+)?|(\d+)(m))$/)
391391

392-
const SCHEMA_07_VALIDATOR = customizeValidator({ ajvOptionsOverrides: { strict: false } })
392+
export const SCHEMA_07_VALIDATOR = customizeValidator({ ajvOptionsOverrides: { strict: false } })
393393
SCHEMA_07_VALIDATOR.ajv.addKeyword('hidden')
394+
SCHEMA_07_VALIDATOR.ajv.addFormat('memory', /^\d+(\.\d+)?(Ki|Mi|Gi|Ti|Pi|Ei|KiB|MiB|GiB|TiB|PiB|EiB)?$/)
395+
SCHEMA_07_VALIDATOR.ajv.addFormat('cpu', /^(?:\d+(\.\d+)?|(\d+)(m))$/)
394396

395397
export const doesJSONConformToSchema07 = (json: string, strict = false): ValidationResponseType => {
396398
try {

0 commit comments

Comments
 (0)