CockpitCaseIndexEntry.fromJson constructor
CockpitCaseIndexEntry.fromJson(
- Object? value, {
- String path = r'$',
- CockpitDecodePolicy decodePolicy = CockpitDecodePolicy.requests,
Decodes a CockpitCaseIndexEntry from a JSON object.
Implementation
factory CockpitCaseIndexEntry.fromJson(
Object? value, {
String path = r'$',
CockpitDecodePolicy decodePolicy = CockpitDecodePolicy.requests,
}) {
final json = CockpitFoundationValueReader.object(value, path);
CockpitFoundationValueReader.keys(
json,
const <String>{
'caseId',
'documentId',
'relativePath',
'title',
'location',
},
path,
required: const <String>{'caseId'},
policy: decodePolicy,
);
return CockpitCaseIndexEntry(
caseId: CockpitFoundationValueReader.id(json['caseId'], '$path.caseId'),
documentId: json['documentId'] == null
? null
: CockpitFoundationValueReader.id(
json['documentId'],
'$path.documentId',
),
relativePath: json['relativePath'] == null
? null
: CockpitFoundationValueReader.relativePath(
json['relativePath'],
'$path.relativePath',
),
title: CockpitFoundationValueReader.optionalString(
json['title'],
'$path.title',
maximum: 256,
),
location: json['location'] == null
? null
: CockpitTestSourceLocation.fromJson(
json['location'],
path: '$path.location',
),
);
}