CockpitTestMatrix.fromJson constructor

CockpitTestMatrix.fromJson(
  1. Object? value, {
  2. required String path,
})

Decodes a CockpitTestMatrix from a JSON object.

Implementation

factory CockpitTestMatrix.fromJson(Object? value, {required String path}) {
  final json = CockpitTestValueReader.object(value, path);
  CockpitTestValueReader.keys(json, const <String>{
    'axes',
    'include',
    'exclude',
    'maxCombinations',
  }, path);
  return CockpitTestMatrix(
    axes: json['axes'] == null
        ? const <String, List<Object?>>{}
        : _readAxes(json['axes'], '$path.axes'),
    include: _readRows(json['include'], '$path.include'),
    exclude: _readRows(json['exclude'], '$path.exclude'),
    maxCombinations: json['maxCombinations'] == null
        ? 256
        : CockpitTestValueReader.integer(
            json['maxCombinations'],
            '$path.maxCombinations',
            minimum: 1,
            maximum: 4096,
          ),
  );
}