Skip to content

Commit

Permalink
Update http and switch to json_schema (#498)
Browse files Browse the repository at this point in the history
* bump up http version

* switch from json_schema2 to json_schema

* formatted the code
  • Loading branch information
buraktabn authored Nov 20, 2024
1 parent 591782e commit e965696
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/polkadart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
convert: ^3.1.1 # BSD-3-Clause
http: ^1.1.0 # BSD-3-Clause
http: ^1.2.2 # BSD-3-Clause
pointycastle: ^3.6.2 # MIT
web_socket_channel: ^2.3.0 # BSD-3-Clause
polkadart_scale_codec: ^1.2.0 # Apache 2.0
Expand Down
2 changes: 1 addition & 1 deletion packages/polkadart_cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
code_builder: ^4.8.0 # BSD-3-Clause
convert: ^3.1.1 # BSD-3-Clause
dart_style: ^2.2.4 # BSD-3-Clause
http: ^1.1.0 # BSD-3-Clause
http: ^1.2.2 # BSD-3-Clause
recase: ^4.1.0 # BSD-2-Clause
path: ^1.8.3 # BSD-3-Clause
yaml: ^3.1.1 # MIT
Expand Down
12 changes: 8 additions & 4 deletions packages/substrate_metadata/lib/utils/spec_version_maker.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
part of utils;

bool validateSpecVersion(dynamic data, {bool reportMultipleErrors = false}) {
final schema = JsonSchema.createSchema(SPEC_VERSION_SCHEMA);
return schema.validate(data, reportMultipleErrors: reportMultipleErrors);
final schema = JsonSchema.create(SPEC_VERSION_SCHEMA);
return Validator(schema)
.validate(data, reportMultipleErrors: reportMultipleErrors)
.isValid;
}

bool validateSpecVersionArray(dynamic data,
{bool reportMultipleErrors = false}) {
final schema = JsonSchema.createSchema(
final schema = JsonSchema.create(
<String, dynamic>{
'type': 'array',
'items': SPEC_VERSION_SCHEMA,
},
);
return schema.validate(data, reportMultipleErrors: reportMultipleErrors);
return Validator(schema)
.validate(data, reportMultipleErrors: reportMultipleErrors)
.isValid;
}

List<SpecVersion> readSpecVersionsFromFilePath(String filePath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/substrate_metadata/lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library utils;

import 'dart:convert';
import 'dart:io';
import 'package:json_schema2/json_schema2.dart';
import 'package:json_schema/json_schema.dart';
import 'package:polkadart_scale_codec/polkadart_scale_codec.dart';
import '../constants/spec_version_schema.dart';
import '../exceptions/exceptions.dart';
Expand Down
2 changes: 1 addition & 1 deletion packages/substrate_metadata/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:

dependencies:
equatable: ^2.0.5
json_schema2: ^2.0.2+9 # MIT
json_schema: ^5.2.0
pointycastle: ^3.6.2 # BSD-3-Clause
polkadart_scale_codec: ^1.2.0
utility: ^1.0.3
Expand Down

0 comments on commit e965696

Please sign in to comment.