Socket
Socket
Sign inDemoInstall

@rjsf/utils

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.13.1 to 5.13.2

5

lib/parser/schemaParser.js

@@ -17,4 +17,3 @@ import forEach from 'lodash/forEach';

function parseSchema(validator, recurseList, rootSchema, schema) {
const recurseRefs = [];
const schemas = retrieveSchemaInternal(validator, schema, rootSchema, undefined, true, recurseRefs);
const schemas = retrieveSchemaInternal(validator, schema, rootSchema, undefined, true);
schemas.forEach((schema) => {

@@ -24,3 +23,3 @@ const sameSchemaIndex = recurseList.findIndex((item) => isEqual(item, schema));

recurseList.push(schema);
const allOptions = resolveAnyOrOneOfSchemas(validator, schema, rootSchema, true, recurseRefs);
const allOptions = resolveAnyOrOneOfSchemas(validator, schema, rootSchema, true);
allOptions.forEach((s) => {

@@ -27,0 +26,0 @@ if (PROPERTIES_KEY in s && s[PROPERTIES_KEY]) {

10

lib/schema/retrieveSchema.d.ts

@@ -22,2 +22,3 @@ import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';

* dependencies as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -51,2 +52,3 @@ * @returns - A list of schemas with the appropriate conditions resolved, possibly with all branches expanded

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -65,2 +67,3 @@ * @returns - The list of schemas having its references, dependencies and allOf schemas resolved

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -98,2 +101,3 @@ * @returns - The list schemas retrieved after having all references resolved

* dependencies as a list of schemas
* @param [recurseList=[]] - The optional, list of recursive references already processed
* @returns - The schema(s) resulting from having its conditions, additional properties, references and dependencies

@@ -115,3 +119,3 @@ * resolved. Multiple schemas may be returned if `expandAllBranches` is true.

*/
export declare function resolveAnyOrOneOfSchemas<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, recurseList: string[], rawFormData?: T): S[];
export declare function resolveAnyOrOneOfSchemas<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, rawFormData?: T): S[];
/** Resolves dependencies within a schema and its 'anyOf/oneOf' children. Passes the `expandAllBranches` flag down to

@@ -125,2 +129,3 @@ * the `resolveAnyOrOneOfSchema()` and `processDependencies()` helper calls.

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -139,2 +144,3 @@ * @returns - The list of schemas with their dependencies resolved

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -161,2 +167,3 @@ * @returns - The schema with the `dependencies` resolved into it

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData]- The current formData to assist retrieving a schema

@@ -177,2 +184,3 @@ * @returns - The list of schemas with the dependent schema resolved into them

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -179,0 +187,0 @@ * @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true

@@ -37,2 +37,3 @@ import { __rest } from "tslib";

* dependencies as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -101,2 +102,3 @@ * @returns - A list of schemas with the appropriate conditions resolved, possibly with all branches expanded

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -135,2 +137,3 @@ * @returns - The list of schemas having its references, dependencies and allOf schemas resolved

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -238,2 +241,3 @@ * @returns - The list schemas retrieved after having all references resolved

* dependencies as a list of schemas
* @param [recurseList=[]] - The optional, list of recursive references already processed
* @returns - The schema(s) resulting from having its conditions, additional properties, references and dependencies

@@ -288,3 +292,3 @@ * resolved. Multiple schemas may be returned if `expandAllBranches` is true.

*/
export function resolveAnyOrOneOfSchemas(validator, schema, rootSchema, expandAllBranches, recurseList, rawFormData) {
export function resolveAnyOrOneOfSchemas(validator, schema, rootSchema, expandAllBranches, rawFormData) {
let anyOrOneOf;

@@ -303,3 +307,5 @@ const { oneOf, anyOf } = schema, remaining = __rest(schema, ["oneOf", "anyOf"]);

anyOrOneOf = anyOrOneOf.map((s) => {
return resolveAllReferences(s, rootSchema, recurseList);
// Due to anyOf/oneOf possibly using the same $ref we always pass a fresh recurse list array so that each option
// can resolve recursive references independently
return resolveAllReferences(s, rootSchema, []);
});

@@ -323,2 +329,3 @@ // Call this to trigger the set of isValid() calls that the schema parser will need

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -330,3 +337,3 @@ * @returns - The list of schemas with their dependencies resolved

const { dependencies } = schema, remainingSchema = __rest(schema, ["dependencies"]);
const resolvedSchemas = resolveAnyOrOneOfSchemas(validator, remainingSchema, rootSchema, expandAllBranches, recurseList, formData);
const resolvedSchemas = resolveAnyOrOneOfSchemas(validator, remainingSchema, rootSchema, expandAllBranches, formData);
return resolvedSchemas.flatMap((resolvedSchema) => processDependencies(validator, dependencies, resolvedSchema, rootSchema, expandAllBranches, recurseList, formData));

@@ -343,2 +350,3 @@ }

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -395,2 +403,3 @@ * @returns - The schema with the `dependencies` resolved into it

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData]- The current formData to assist retrieving a schema

@@ -430,2 +439,3 @@ * @returns - The list of schemas with the dependent schema resolved into them

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -432,0 +442,0 @@ * @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true

{
"name": "@rjsf/utils",
"version": "5.13.1",
"version": "5.13.2",
"main": "dist/index.js",

@@ -28,3 +28,3 @@ "module": "lib/index.js",

"test": "jest",
"test:debug": "node --inspect-brk node_modules/.bin/jest"
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest"
},

@@ -90,3 +90,3 @@ "lint-staged": {

"license": "Apache-2.0",
"gitHead": "a8039b4b7b872606a14e28885ba4e7faea9e2bfa"
"gitHead": "4cfaa984c3343d9cbaabd147c5c24b2c01e28726"
}

@@ -25,4 +25,3 @@ import forEach from 'lodash/forEach';

) {
const recurseRefs: string[] = [];
const schemas = retrieveSchemaInternal<T, S, F>(validator, schema, rootSchema, undefined, true, recurseRefs);
const schemas = retrieveSchemaInternal<T, S, F>(validator, schema, rootSchema, undefined, true);
schemas.forEach((schema) => {

@@ -32,3 +31,3 @@ const sameSchemaIndex = recurseList.findIndex((item) => isEqual(item, schema));

recurseList.push(schema);
const allOptions = resolveAnyOrOneOfSchemas<T, S, F>(validator, schema, rootSchema, true, recurseRefs);
const allOptions = resolveAnyOrOneOfSchemas<T, S, F>(validator, schema, rootSchema, true);
allOptions.forEach((s) => {

@@ -35,0 +34,0 @@ if (PROPERTIES_KEY in s && s[PROPERTIES_KEY]) {

@@ -55,2 +55,3 @@ import get from 'lodash/get';

* dependencies as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -146,2 +147,3 @@ * @returns - A list of schemas with the appropriate conditions resolved, possibly with all branches expanded

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -211,2 +213,3 @@ * @returns - The list of schemas having its references, dependencies and allOf schemas resolved

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -362,2 +365,3 @@ * @returns - The list schemas retrieved after having all references resolved

* dependencies as a list of schemas
* @param [recurseList=[]] - The optional, list of recursive references already processed
* @returns - The schema(s) resulting from having its conditions, additional properties, references and dependencies

@@ -443,10 +447,3 @@ * resolved. Multiple schemas may be returned if `expandAllBranches` is true.

F extends FormContextType = any
>(
validator: ValidatorType<T, S, F>,
schema: S,
rootSchema: S,
expandAllBranches: boolean,
recurseList: string[],
rawFormData?: T
) {
>(validator: ValidatorType<T, S, F>, schema: S, rootSchema: S, expandAllBranches: boolean, rawFormData?: T) {
let anyOrOneOf: S[] | undefined;

@@ -464,3 +461,5 @@ const { oneOf, anyOf, ...remaining } = schema;

anyOrOneOf = anyOrOneOf.map((s) => {
return resolveAllReferences(s, rootSchema, recurseList);
// Due to anyOf/oneOf possibly using the same $ref we always pass a fresh recurse list array so that each option
// can resolve recursive references independently
return resolveAllReferences(s, rootSchema, []);
});

@@ -485,2 +484,3 @@ // Call this to trigger the set of isValid() calls that the schema parser will need

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -504,3 +504,2 @@ * @returns - The list of schemas with their dependencies resolved

expandAllBranches,
recurseList,
formData

@@ -530,2 +529,3 @@ );

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData, if any, to assist retrieving a schema

@@ -616,2 +616,3 @@ * @returns - The schema with the `dependencies` resolved into it

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData]- The current formData to assist retrieving a schema

@@ -679,2 +680,3 @@ * @returns - The list of schemas with the dependent schema resolved into them

* as a list of schemas
* @param recurseList - The list of recursive references already processed
* @param [formData] - The current formData to assist retrieving a schema

@@ -681,0 +683,0 @@ * @returns - Either an array containing the best matching option or all options if `expandAllBranches` is true

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc