MCPcopy
hub / github.com/fastify/fast-json-stringify / buildAllOf

Function buildAllOf

index.js:1088–1116  ·  view source on GitHub ↗
(context, location, input)

Source from the content-addressed store, hash-verified

1086}
1087
1088function buildAllOf (context, location, input) {
1089 const schema = location.schema
1090
1091 let mergedSchemaId = context.mergedSchemasIds.get(schema)
1092 if (mergedSchemaId) {
1093 const mergedLocation = getMergedLocation(context, mergedSchemaId)
1094 return buildValue(context, mergedLocation, input)
1095 }
1096
1097 mergedSchemaId = `__fjs_merged_${schemaIdCounter++}`
1098 context.mergedSchemasIds.set(schema, mergedSchemaId)
1099
1100 const { allOf, ...schemaWithoutAllOf } = location.schema
1101 const locations = [
1102 new Location(
1103 schemaWithoutAllOf,
1104 location.schemaId,
1105 location.jsonPointer
1106 )
1107 ]
1108
1109 const allOfsLocation = location.getPropertyLocation('allOf')
1110 for (let i = 0, allOfLength = allOf.length; i < allOfLength; i++) {
1111 locations.push(allOfsLocation.getPropertyLocation(i))
1112 }
1113
1114 const mergedLocation = mergeLocations(context, mergedSchemaId, locations)
1115 return buildValue(context, mergedLocation, input)
1116}
1117
1118function buildOneOf (context, location, input) {
1119 context.validatorSchemasIds.add(location.schemaId)

Callers 1

buildValueFunction · 0.85

Calls 4

getMergedLocationFunction · 0.85
buildValueFunction · 0.85
mergeLocationsFunction · 0.85
getPropertyLocationMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…