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

Function toDataPathSegments

packages/core/src/util/path.ts:57–70  ·  view source on GitHub ↗
(schemaPath: string)

Source from the content-addressed store, hash-verified

55 * @returns {string[]} an array containing only non-schema-specific segments
56 */
57export const toDataPathSegments = (schemaPath: string): string[] => {
58 const s = schemaPath
59 .replace(/(anyOf|allOf|oneOf)\/[\d]+\//g, '')
60 .replace(/(then|else)\//g, '');
61 const segments = s.split('/');
62
63 const decodedSegments = segments.map(decode);
64
65 const startFromRoot = decodedSegments[0] === '#' || decodedSegments[0] === '';
66 const startIndex = startFromRoot ? 2 : 1;
67 return range(startIndex, decodedSegments.length, 2).map(
68 (idx) => decodedSegments[idx]
69 );
70};
71
72/**
73 * Convert a schema path (i.e. JSON pointer) to a data path.

Callers 3

fromScopedFunction · 0.90
composeWithUiFunction · 0.90
toDataPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…