JSON parser - Missing paths and test cases

Let's say we want to parse a json file and we enter a metric that exists only sometimes, ie hardware model would likely not be present on a virtual device.

In the past I've used _groups to filter matching paths in the JSON data and to avoid exceptions. However, today when I had the pleasure of updating some scripts I encountered an indeni script which referred to a path which did not exist in some of the test cases and the test was still successful which I find strange?

Some questions:

  • Is non-existing paths not throwing exceptions anymore?
  • What's the point in having _optional in that case?

The script and input files I am referring to is:



And the missing metric is:

  • hardware-eos-datesoftware-eos-date

Am I missing something?


Ps. Is it just me that thinks that the input files always looks moderately surprised to see me? "0_0"

The script will fail only if no metrics were parsed at all (not just a specific definition).

Ps. Haha