Skip to content

Commit 08dc1e0

Browse files
Fix indices to get unit tests to pass. I don't actually understand why this works.
1 parent e43a07f commit 08dc1e0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/src/json_schema/json_schema.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,7 @@ class JsonSchema {
346346
} else if (_root.schemaVersion == SchemaVersion.draft6) {
347347
accessMap = _accessMapV6;
348348
} else if (_root.schemaVersion >= SchemaVersion.draft2019_09) {
349-
final vocabMap = Map()
350-
..addAll(_vocabMaps)
351-
..addAll(_customVocabMap);
349+
final vocabMap = Map()..addAll(_vocabMaps)..addAll(_customVocabMap);
352350
this.metaschemaVocabulary.keys.forEach((vocabUri) {
353351
accessMap.addAll(vocabMap[vocabUri.toString()]);
354352
});
@@ -595,7 +593,7 @@ class JsonSchema {
595593
// Follow JSON Pointer path of fragments if provided.
596594
if (pathUri.fragment.isNotEmpty) {
597595
final List<String> fragments = Uri.parse(pathUri.fragment).pathSegments;
598-
final foundSchema = _recursiveResolvePath(pathUri, fragments, baseSchema, refsEncountered);
596+
final foundSchema = _recursiveResolvePath(pathUri, fragments.sublist(0), baseSchema, refsEncountered);
599597
_memomizedResults[currentPair] = foundSchema;
600598
return foundSchema;
601599
}
@@ -761,7 +759,7 @@ class JsonSchema {
761759
// If currentSchema has additional values, then traverse both paths to find the result.
762760
if (i + 1 < fragments.length && currentSchema._schemaMap.keys.toSet().difference(consts).length > 1) {
763761
return _resolveParallelPaths(
764-
pathUri, fragments.sublist(i, fragments.length - 1), currentSchema, refsEncountered);
762+
pathUri, fragments.sublist(i + 1, fragments.length), currentSchema, refsEncountered);
765763
}
766764

767765
currentSchema = _resolveSchemaWithAccounting(pathUri, currentSchema, refsEncountered);

0 commit comments

Comments
 (0)