Skip to content

Commit 3faa573

Browse files
committed
fix: use SCHEMA_07_VALIDATOR instead of SCHEMA_07_VALIDATOR_STRICT in rjsf
1 parent a5b5162 commit 3faa573

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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)