-
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
Precompiled schema not all $ref resolved #3902
Comments
8 tasks
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Oct 12, 2023
…f/oneOf` branches Fixes rjsf-team#3902 by fixing the recursive `$ref` resolution when resolving `anyOf/oneOf` branches - In `@rjsf/utils`, fixed rjsf-team#3902 as follows: - Updated the `package.json` to fix the path to `jest` within the `test:debug` script after NPM workspaces were used - Updated the `resolveAnyOrOneOfSchemas()` to no longer take a `recurseList` array and to have each branch of the `anyOf`/`oneOf` pass an empty array to the `resolveAllReferences()` function - Updated `parseSchema()` and `resolveDependencies()` to no longer pass `recurseList` to `resolveAnyOrOneOfSchemas()` - Updated the `SUPER_SCHEMA` to add the use case provided in rjsf-team#3902 to verify the issue is fixed - Updated the snapshot for the `schemaParser` test with the updated parsed schema - In `@rjsf/validator-ajv8`, added an optimization to the `AJV8PrecompiledSchema` class - Added a new `ensureSameRootSchema()` function that only resolves the `rootSchema` with the `formData` when it does not match the given `schema` before throwing an error - Used this new function in `rawValidation()` and `isValid()`, replacing the duplicate existing code - Updated the tests to add unit tests for the new function as well as removing the need to use a resolved `rootSchema` in the tests - Updated the `CHANGELOG.md` accordingly
8 tasks
heath-freenome
added a commit
that referenced
this issue
Oct 12, 2023
…f/oneOf` branches (#3903) Fixes #3902 by fixing the recursive `$ref` resolution when resolving `anyOf/oneOf` branches - In `@rjsf/utils`, fixed #3902 as follows: - Updated the `package.json` to fix the path to `jest` within the `test:debug` script after NPM workspaces were used - Updated the `resolveAnyOrOneOfSchemas()` to no longer take a `recurseList` array and to have each branch of the `anyOf`/`oneOf` pass an empty array to the `resolveAllReferences()` function - Updated `parseSchema()` and `resolveDependencies()` to no longer pass `recurseList` to `resolveAnyOrOneOfSchemas()` - Updated the `SUPER_SCHEMA` to add the use case provided in #3902 to verify the issue is fixed - Updated the snapshot for the `schemaParser` test with the updated parsed schema - In `@rjsf/validator-ajv8`, added an optimization to the `AJV8PrecompiledSchema` class - Added a new `ensureSameRootSchema()` function that only resolves the `rootSchema` with the `formData` when it does not match the given `schema` before throwing an error - Used this new function in `rawValidation()` and `isValid()`, replacing the duplicate existing code - Updated the tests to add unit tests for the new function as well as removing the need to use a resolved `rootSchema` in the tests - Updated the `CHANGELOG.md` accordingly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
What theme are you using?
core
Version
5.13.1
Current Behavior
For precompiled schemas all $refs have to be resolved when creating the different schema definitions for ajv to create them. In a recent update in utils
retrieveSchema.ts
resolveAllReferences
it will now only resolve the $ref the first time it was found and will ignore after. This cause any schema with multiple references to the same $ref to fail pre compilation.Here is a simple example schema
and then the output from running
compileSchemaValidators
Expected Behavior
Resolve all $refs
Steps To Reproduce
No response
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: