Skip to content

Commit

Permalink
fix json schema package
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Jul 3, 2024
1 parent ffaa91e commit 71e3df5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/datasource/remote/model/token_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import 'package:async/async.dart';
import 'package:collection/collection.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:json_schema2/json_schema2.dart';
import 'package:seeds/datasource/remote/api/http_repo/seeds_chain_names.dart';
import 'package:json_schema/json_schema.dart';
import 'package:seeds/datasource/remote/api/tokenmodels_repository.dart';
import 'package:seeds/datasource/remote/firebase/firebase_remote_config.dart';
import 'package:seeds/domain-shared/shared_use_cases/get_token_models_use_case.dart';
Expand Down Expand Up @@ -55,7 +54,7 @@ class TokenModel extends Equatable {
final result = await TokenModelsRepository().getSchema();
if (result.isValue) {
final tmastrSchemaMap = result.asValue!.value;
tmastrSchema = JsonSchema.createSchema(tmastrSchemaMap);
tmastrSchema = JsonSchema.create(tmastrSchemaMap);
return Result.value(null);
}
print('Error getting Token Master schema from chain');
Expand Down Expand Up @@ -85,9 +84,9 @@ class TokenModel extends Equatable {
if (tmastrSchema == null) {
return null;
}
final validationErrors = tmastrSchema!.validateWithErrors(parsedJson);
if (validationErrors.isNotEmpty) {
print('${data["symbolcode"]}:\t${validationErrors.map((e) => e.toString())}');
final validationResult = tmastrSchema!.validate(parsedJson);
if (validationResult.errors.isNotEmpty) {
print('${data["symbolcode"]}:\t${validationResult.errors.map((e) => e.toString())}');
return null;
}
return TokenModel(
Expand Down Expand Up @@ -188,7 +187,7 @@ class TokenModel extends Equatable {
}

const seedsToken = TokenModel(
chainName: SeedsChains.telos.value,
chainName: "Telos",
contract: "token.seeds",
symbol: "SEEDS",
name: "Seeds",
Expand Down

0 comments on commit 71e3df5

Please sign in to comment.