Model.fromJson constructor

Model.fromJson(
  1. Object? j
)

Implementation

factory Model.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Model(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    versionId: switch (json['versionId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    versionAliases: switch (json['versionAliases']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"versionAliases" is not a list'),
    },
    versionCreateTime: switch (json['versionCreateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    versionUpdateTime: switch (json['versionUpdateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    versionDescription: switch (json['versionDescription']) {
      null => '',
      Object $1 => decodeString($1),
    },
    defaultCheckpointId: switch (json['defaultCheckpointId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    predictSchemata: switch (json['predictSchemata']) {
      null => null,
      Object $1 => PredictSchemata.fromJson($1),
    },
    metadataSchemaUri: switch (json['metadataSchemaUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    metadata: switch (json['metadata']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    supportedExportFormats: switch (json['supportedExportFormats']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) Model_ExportFormat.fromJson(i),
      ],
      _ => throw const FormatException(
        '"supportedExportFormats" is not a list',
      ),
    },
    trainingPipeline: switch (json['trainingPipeline']) {
      null => '',
      Object $1 => decodeString($1),
    },
    containerSpec: switch (json['containerSpec']) {
      null => null,
      Object $1 => ModelContainerSpec.fromJson($1),
    },
    artifactUri: switch (json['artifactUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    supportedDeploymentResourcesTypes:
        switch (json['supportedDeploymentResourcesTypes']) {
          null => [],
          List<Object?> $1 => [
            for (final i in $1) Model_DeploymentResourcesType.fromJson(i),
          ],
          _ => throw const FormatException(
            '"supportedDeploymentResourcesTypes" is not a list',
          ),
        },
    supportedInputStorageFormats:
        switch (json['supportedInputStorageFormats']) {
          null => [],
          List<Object?> $1 => [for (final i in $1) decodeString(i)],
          _ => throw const FormatException(
            '"supportedInputStorageFormats" is not a list',
          ),
        },
    supportedOutputStorageFormats:
        switch (json['supportedOutputStorageFormats']) {
          null => [],
          List<Object?> $1 => [for (final i in $1) decodeString(i)],
          _ => throw const FormatException(
            '"supportedOutputStorageFormats" is not a list',
          ),
        },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    deployedModels: switch (json['deployedModels']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) DeployedModelRef.fromJson(i)],
      _ => throw const FormatException('"deployedModels" is not a list'),
    },
    explanationSpec: switch (json['explanationSpec']) {
      null => null,
      Object $1 => ExplanationSpec.fromJson($1),
    },
    etag: switch (json['etag']) {
      null => '',
      Object $1 => decodeString($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    modelSourceInfo: switch (json['modelSourceInfo']) {
      null => null,
      Object $1 => ModelSourceInfo.fromJson($1),
    },
    originalModelInfo: switch (json['originalModelInfo']) {
      null => null,
      Object $1 => Model_OriginalModelInfo.fromJson($1),
    },
    metadataArtifact: switch (json['metadataArtifact']) {
      null => '',
      Object $1 => decodeString($1),
    },
    baseModelSource: switch (json['baseModelSource']) {
      null => null,
      Object $1 => Model_BaseModelSource.fromJson($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    checkpoints: switch (json['checkpoints']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Checkpoint.fromJson(i)],
      _ => throw const FormatException('"checkpoints" is not a list'),
    },
  );
}