MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / schemaSubPathMatches

Function schemaSubPathMatches

packages/core/src/testers/testers.ts:137–165  ·  view source on GitHub ↗
(
    subPath: string,
    predicate: (schema: JsonSchema, rootSchema: JsonSchema) => boolean
  )

Source from the content-addressed store, hash-verified

135
136export const schemaSubPathMatches =
137 (
138 subPath: string,
139 predicate: (schema: JsonSchema, rootSchema: JsonSchema) => boolean
140 ): Tester =>
141 (
142 uischema: UISchemaElement,
143 schema: JsonSchema,
144 context: TesterContext
145 ): boolean => {
146 if (isEmpty(uischema) || !isControl(uischema)) {
147 return false;
148 }
149 const schemaPath = uischema.scope;
150 let currentDataSchema: JsonSchema = schema;
151 if (hasType(schema, 'object')) {
152 currentDataSchema = resolveSchema(
153 schema,
154 schemaPath,
155 context?.rootSchema
156 );
157 }
158 currentDataSchema = get(currentDataSchema, subPath);
159
160 if (currentDataSchema === undefined) {
161 return false;
162 }
163
164 return predicate(currentDataSchema, context?.rootSchema);
165 };
166
167/**
168 * Only applicable for Controls.

Callers 4

testers.test.tsFile · 0.90
testers.tsFile · 0.85

Calls 3

hasTypeFunction · 0.90
resolveSchemaFunction · 0.90
isControlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…