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

Function getControlPath

packages/core/src/util/errors.ts:54–73  ·  view source on GitHub ↗
(error: ErrorObject)

Source from the content-addressed store, hash-verified

52};
53
54export const getControlPath = (error: ErrorObject) => {
55 // Up until AJV v7 the path property was called 'dataPath'
56 // With AJV v8 the property was renamed to 'instancePath'
57 let controlPath = (error as any).dataPath || error.instancePath || '';
58
59 // change '/' chars to '.'
60 controlPath = controlPath.replace(/\//g, '.');
61
62 const invalidProperty = getInvalidProperty(error);
63 if (invalidProperty !== undefined) {
64 controlPath = `${controlPath}.${invalidProperty}`;
65 }
66
67 // remove '.' chars at the beginning of paths
68 controlPath = controlPath.replace(/^\./, '');
69
70 // decode JSON Pointer escape sequences
71 controlPath = decode(controlPath);
72 return controlPath;
73};
74
75export const errorsAt =
76 (

Callers 5

renderMethod · 0.90
core.test.tsFile · 0.90
defaultErrorTranslatorFunction · 0.90
useVuetifyControlFunction · 0.90
errorsAtFunction · 0.85

Calls 2

decodeFunction · 0.90
getInvalidPropertyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…