Skip to content

Commit

Permalink
Merge branch 'Workiva:master' into fix/issue-175-export-ValidationRes…
Browse files Browse the repository at this point in the history
…ults
  • Loading branch information
mx1up authored Jul 24, 2024
2 parents c64dd96 + 721a365 commit 4ed36e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/src/json_schema/json_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ class JsonSchema {
_customFormats = customFormats;
_rootMemomizedPathResults = {};
try {
_fetchedFromUriBase = JsonSchemaUtils.getBaseFromFullUri(_fetchedFromUri!);
// Only fetch the base if given
if (_fetchedFromUri != null) {
_fetchedFromUriBase = JsonSchemaUtils.getBaseFromFullUri(_fetchedFromUri!);
}
} catch (e) {
// ID base can't be set for schemes other than HTTP(S).
// This is expected behavior.
Expand Down
7 changes: 5 additions & 2 deletions lib/src/json_schema/models/validation_results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import 'package:json_schema/src/json_schema/validator.dart';

/// The result of validating data against a schema
class ValidationResults {
ValidationResults(List<ValidationError> errors, List<ValidationError> warnings)
ValidationResults(
List<ValidationError> errors, List<ValidationError> warnings)
: errors = List.of(errors),
warnings = List.of(warnings);

Expand All @@ -52,7 +53,9 @@ class ValidationResults {

@override
String toString() {
return '${errors.isEmpty ? 'VALID' : 'INVALID'}${errors.isEmpty ? ', Errors: $errors' : ''}${warnings.isEmpty ? ', Warnings: $warnings' : ''}';
return '${errors.isEmpty ? 'VALID' : 'INVALID'}'
'${errors.isEmpty ? '' : ', Errors: $errors'}'
'${warnings.isEmpty ? '' : ', Warnings: $warnings'}';
}

/// Whether the [Instance] was valid against its [JsonSchema]
Expand Down

0 comments on commit 4ed36e5

Please sign in to comment.