-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Validation not working after generating the build #2020
Comments
Does this error only happen with that specific schema? Or with even a simple schema such as |
Yes the issue is also happening for simple schema |
FYI i am using typescript to write the code. |
Hi There, Any update on this issue? |
Hi, I also ran into the same issue. After debugging it, it seems that it might relate to this issue actually: ajv-validator/ajv#551 |
If you are using helmet in react please use version 3.22.0 it internally has helmet-csp which solved this contect Security Policy issue or you can seprately install helmet-csp from npm. |
@jitdwoodside I understand this is an old post, but have you solved the problem and how? Thanks. |
@jitdwoodside have you find anything to resolve the above issue? |
So the fix for this is NOT really in @rjsf per this comment in AJV |
This could be a potential path forward: #3269 |
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you. |
This issue was closed because of lack of recent activity. Reopen if you still need assistance. |
Prerequisites
Description
The validation is working fine in local but after generating production build it is showing error. Here is the error
Error compiling schema, function code: var refVal1 = refVal[1]; var validate = function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; var vErrors = null; var errors = 0; if (rootData === undefined) rootData = data; var errs_1 = errors; var errs_2 = errors; if ((typeof data !== "number" || (data % 1) || data !== data)) { var err = { keyword: 'type' , dataPath: (dataPath || '') + "" , schemaPath: '#/definitions/nonNegativeInteger/type' , params: { type: 'integer' } , message: 'should be integer' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } if ((typeof data === "number")) { if ( data < 0 || data !== data) { var err = { keyword: 'minimum' , dataPath: (dataPath || '') + "" , schemaPath: '#/definitions/nonNegativeInteger/minimum' , params: { comparison: '>=', limit: 0, exclusive: false } , message: 'should be >= 0' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } var valid2 = errors === errs_2; var valid1 = errors === errs_1; validate.errors = vErrors; return errors === 0; }; return validate;
Steps to Reproduce
Expected behavior
The validation should work and show error message
Actual behavior
Showing error:-
Error compiling schema, function code: var refVal1 = refVal[1]; var validate = function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; var vErrors = null; var errors = 0; if (rootData === undefined) rootData = data; var errs_1 = errors; var errs_2 = errors; if ((typeof data !== "number" || (data % 1) || data !== data)) { var err = { keyword: 'type' , dataPath: (dataPath || '') + "" , schemaPath: '#/definitions/nonNegativeInteger/type' , params: { type: 'integer' } , message: 'should be integer' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } if ((typeof data === "number")) { if ( data < 0 || data !== data) { var err = { keyword: 'minimum' , dataPath: (dataPath || '') + "" , schemaPath: '#/definitions/nonNegativeInteger/minimum' , params: { comparison: '>=', limit: 0, exclusive: false } , message: 'should be >= 0' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } var valid2 = errors === errs_2; var valid1 = errors === errs_1; validate.errors = vErrors; return errors === 0; }; return validate;
Version
I am using "@rjsf/core": "^2.3.0"
The text was updated successfully, but these errors were encountered: