function getDiagnosticsForRegularProperties()

in src/validation/utils/getDiagnosticsForNode.ts [94:114]


function getDiagnosticsForRegularProperties(rootNode: ObjectASTNode, document: TextDocument, schemaPart: SchemaObject) {
  const diagnostics: Diagnostic[] = []

  if (schemaPart.properties) {
    schemaPart = schemaPart.properties as SchemaObject
  }

  rootNode.properties.forEach((prop) => {
    const propName = prop.keyNode.value
    const propertySchema: unknown = schemaPart[propName]

    if (!propertySchema) {
      diagnostics.push(getPropertyNodeDiagnostic(prop, document, MESSAGES.INVALID_PROPERTY_NAME))
    } else if (prop.valueNode && isObject(propertySchema)) {
      // evaluate nested schema
      diagnostics.push(...getDiagnosticsForNode(prop.valueNode, document, propertySchema as SchemaObject))
    }
  })

  return diagnostics
}