CockpitTestArtifactEntry.fromJson constructor
Decodes a CockpitTestArtifactEntry from a JSON object.
Implementation
factory CockpitTestArtifactEntry.fromJson(
Object? value, {
String path = r'$',
}) {
final json = CockpitTestValueReader.object(value, path);
CockpitTestValueReader.keys(
json,
const <String>{
'artifactId',
'kind',
'relativePath',
'mediaType',
'sizeBytes',
'sha256',
'stepExecutionId',
},
path,
required: const <String>{
'artifactId',
'kind',
'relativePath',
'mediaType',
'sizeBytes',
'sha256',
},
);
return CockpitTestArtifactEntry(
artifactId: CockpitTestValueReader.string(
json['artifactId'],
'$path.artifactId',
id: true,
),
kind: CockpitTestValueReader.string(json['kind'], '$path.kind'),
relativePath: CockpitTestValueReader.string(
json['relativePath'],
'$path.relativePath',
),
mediaType: CockpitTestValueReader.string(
json['mediaType'],
'$path.mediaType',
),
sizeBytes: CockpitTestValueReader.integer(
json['sizeBytes'],
'$path.sizeBytes',
minimum: 0,
),
sha256: CockpitTestValueReader.string(json['sha256'], '$path.sha256'),
stepExecutionId: CockpitTestValueReader.optionalString(
json['stepExecutionId'],
'$path.stepExecutionId',
),
);
}