Extract types from Metric expressions

I have a metric defined like this on Facility:
path’: u"servicePoints.meterMappings.to.(profile==‘ICHA’).pointMeasurements.(measurementType==‘energie’).
Is there an api that can get the metric and return the list of types that are in the path, specifically: [ServicePoint, ServicePointMeterAsset, MeterAsset, PointPhysicaleasurementSeries] ?

You would have to write it, but the pieces exist.

For example:

Facility.fieldType(“servicePoints”).valueType() will tell you that the first field is an array of ServicePoints. Loop over the fields and go at it.

I need something that can parse the path inside the metric.

You could try Expr.parse(). This API will return you an AST. Note that as of 7.9 this api is private and beta so use at your own risk.