in src/validation/utils/getDiagnosticsForNode.ts [116:143]
export default function getDiagnosticsForNode(
rootNode: ASTNode,
document: TextDocument,
schemaPart: SchemaObject,
): Diagnostic[] {
const arrayOfType = schemaPart['Fn:ArrayOf']
const oneOfType = schemaPart['Fn:OneOf']
const valueOfType = schemaPart['Fn:ValueOf']
// Fn:ArrayOf
// if it contains Fn:ArrayOf property all the other values will be ignored
if (typeof arrayOfType === 'string' && isArrayNode(rootNode)) {
return getDiagnosticsForArrayOfSchema(rootNode, document, arrayOfType)
// Fn:OneOf
} else if (typeof oneOfType === 'string' && isObjectNode(rootNode)) {
return getDiagnosticsForOneOfSchema(rootNode, document, schemaPart, oneOfType)
// Fn:ValueOf
} else if (typeof valueOfType === 'string' && isObjectNode(rootNode)) {
const newSchemaPart = referenceTypes[valueOfType] as SchemaObject
return getDiagnosticsForNode(rootNode, document, newSchemaPart)
// Regular properties
} else if (isObjectNode(rootNode)) {
return getDiagnosticsForRegularProperties(rootNode, document, schemaPart)
}
return []
}