MCPcopy Index your code
hub / github.com/fastify/fast-json-stringify / resolveRef

Function resolveRef

index.js:61–83  ·  view source on GitHub ↗
(context, location)

Source from the content-addressed store, hash-verified

59}
60
61function resolveRef (context, location) {
62 const ref = location.schema.$ref
63
64 let hashIndex = ref.indexOf('#')
65 if (hashIndex === -1) {
66 hashIndex = ref.length
67 }
68
69 const schemaId = ref.slice(0, hashIndex) || location.schemaId
70 const jsonPointer = ref.slice(hashIndex) || '#'
71
72 const schema = context.refResolver.getSchema(schemaId, jsonPointer)
73 if (schema === null) {
74 throw new Error(`Cannot find reference "${ref}"`)
75 }
76
77 const newLocation = new Location(schema, schemaId, jsonPointer)
78 if (schema.$ref !== undefined) {
79 return resolveRef(context, newLocation)
80 }
81
82 return newLocation
83}
84
85function getMergedLocation (context, mergedSchemaId) {
86 const mergedSchema = context.refResolver.getSchema(mergedSchemaId, '#')

Callers 5

buildInnerObjectFunction · 0.85
mergeLocationsFunction · 0.85
buildArrayFunction · 0.85
traverseFunction · 0.85
buildValueFunction · 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…