function validatePathField()

in src/validation/validateStates.ts [91:106]


function validatePathField(pathField: PropertyASTNode, document: TextDocument): Diagnostic[] {
  const diagnostics: Diagnostic[] = []
  const valueNode = pathField.valueNode
  const propValue = valueNode && valueNode.value

  if (typeof propValue !== 'string' || !(isJsonPath(propValue) || isIntrinsicFunctionWithStringReturn(propValue))) {
    const { length, offset } = pathField
    const range = Range.create(document.positionAt(offset), document.positionAt(offset + length))

    diagnostics.push(
      Diagnostic.create(range, MESSAGES.INVALID_JSON_PATH_OR_INTRINSIC_STRING_ONLY, DiagnosticSeverity.Error),
    )
  }

  return diagnostics
}