CockpitTestRunContext.fromJson constructor
Decodes a CockpitTestRunContext from a JSON object.
Implementation
factory CockpitTestRunContext.fromJson(Object? value, {String path = r'$'}) {
final json = CockpitTestValueReader.object(value, path);
const fields = <String>{
'projectId',
'workspaceId',
'runId',
'caseId',
'attemptId',
'engineVersion',
'auth',
};
CockpitTestValueReader.keys(json, fields, path, required: fields);
String id(String key) =>
CockpitTestValueReader.string(json[key], '$path.$key', id: true);
return CockpitTestRunContext(
projectId: id('projectId'),
workspaceId: id('workspaceId'),
runId: id('runId'),
caseId: id('caseId'),
attemptId: id('attemptId'),
engineVersion: CockpitTestValueReader.string(
json['engineVersion'],
'$path.engineVersion',
),
authorizationMode: CockpitTestValueReader.enumeration(
json['auth'],
CockpitAuthorizationMode.values,
'$path.auth',
),
);
}