function getMaxDefinitionLevel(schemaPath) {
  let maxLevel = 0
  for (const { element } of schemaPath.slice(1)) {
    if (element.repetition_type !== 'REQUIRED') {
      maxLevel++
    }
  }
  return maxLevel
}
Get the max definition level for a given schema path.

@param {SchemaTree[]} schemaPath
@returns {number} max definition level