Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixes #3761 and restores 100% test coverage in utils and validat…
…or-ajv8 (#3895) Fixes #3671 by resolving refs inside of `properties` and array `items` and restoring `100%` unit test coverage for `utils` and `validator-ajv8` - Updated `package.json` to add `@types/jest` to the global `devDependencies` - In `@rjsf/utils`, fixed #3671 and restored 100% test coverage as follows: - Updated `jest.config.js` to restore test coverage threshold to 100% - Updated `resolveAllReferences()` to take a new `recurseList: string[]` parameter that is used to prevent recurse `$ref` processing - Return the `schema` directly when it is not an object and also return the original `schema` when the `resolvedSchema` is identical - Updated the `resolveReference()` function to call `resolveAllReferences()` and only call `retrieveSchemaInternal()` when the the `updatedSchema` is different than the original - Updated the `resolveSchema()` function to always call `resolveReference()` and only return the `updatedSchemas` when something was changed - Updated `retrieveSchemaInternal()` to take a new `recurseList: string[] = []` parameter that is passed to `resolveSchema()` and `resolveCondition()` - Updated many of the internal functions to take a `recurseList: string[]` parameter that is forwarded to any function that ultimately calls `retrieveSchemaInternal()` or `resolveAllReferences()` - Updated the `SchemaParser` to properly pass the `recurseList` array to `retrieveSchemaInternal()` and `resolveAnyOrOneOfSchemas()` - Updated the `getClosestMatchingOption()` function to pass an empty array to the `resolveAllReferences()` function for `recurseList` - Updated the `computeDefaults()` function to pass an empty array to the `resolveDependencies()` function for `recurseList` - Also removed an unnecessary `isObject()` check for `formData` in when dealing with `additionalProperties` since it is always guaranteed to be an object - Added/updated tests to ensure that all of the `@rjsf/utils` have 100% test coverage - In `@rjsf/validator-ajv8` to fix tests due to the #3671 changes and restored 100% test coverage as follows: - Updated `jest.config.js` to restore test coverage threshold to 100% - Updated the tests for `precompiledValidator` to call `retrieveSchema()` on the precompiled `rootSchema` to avoid errors caused by the `retrieveSchema()` changes - Updated `validator.ts` to make the `isValid()` call not check if the `rootSchema` already exists (because it doesn't) since the `finally` always removes it - Updated the `validator` tests to restore 100% test coverage - Updated the `CHANGELOG.md` accordingly while also adding the description for #3870
- Loading branch information