isValidPath function
PIComposer APIPIComposer API

isValidPath#

bool isValidPath(PIAttributePath<dynamic> path)

Validates whether a given attribute path is structurally correct.

A valid path must meet the following criteria:

  1. Must not be empty
  2. The first token must be a String (starting with an attribute or type name)
  3. All subsequent tokens must be either String or int

This function only checks the path's syntactic structure, not whether the path actually resolves to a valid attribute in a specific model.

Example of valid paths:

['ObjectPlacement']  // ✅ Starts with string
['Name', 0]          // ✅ String followed by integer
['RelativePlacement', 'IfcAxis2Placement3D', 'Location']  // ✅ Multiple strings

Example of invalid paths:

[]                   // ❌ Empty path
[123]                // ❌ First token is not a string
['Name', true]       // ❌ Contains non-string, non-integer token

path: The attribute path to validate. Returns true if the path is structurally valid, false otherwise.