Skip to content

Commit 675c11c

Browse files
committed
Change Resolver::enter() to register new schema
1 parent 0b795c8 commit 675c11c

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/Resolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ public function enter(Uri $uri, stdClass $schema)
139139
$currentUri = $this->getCurrentUri();
140140
$resolvedUri = $uri->resolveAgainst($currentUri);
141141
$this->uriStack[] = $resolvedUri;
142+
143+
if ($resolvedUri->isAbsolute() && !$resolvedUri->hasPointer()) {
144+
$this->registerSchema($schema, $resolvedUri);
145+
}
142146
}
143147

144148
/**

tests/Data/schemas/valid/scoped-references.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
},
77
"bar": {
88
"$ref": "/valid/exclusiveMinimum-not-present.json"
9-
},
10-
"baz": {
11-
"id": "exclusiveMaximum-not-present.json",
12-
"oneOf": [
13-
{
14-
"$ref": "#"
15-
}
16-
]
179
}
1810
}
1911
}

tests/WalkerTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ public function testResolveReferencesWithScopeChanges()
107107

108108
$this->assertObjectHasAttribute('bar', $resolved->properties);
109109
$this->assertObjectHasAttribute('minimum', $resolved->properties->bar);
110-
111-
$this->assertObjectHasAttribute('baz', $resolved->properties);
112-
$this->assertObjectHasAttribute('oneOf', $resolved->properties->baz);
113-
$this->assertArrayHasKey(0, $resolved->properties->baz->oneOf);
114-
$this->assertObjectHasAttribute('maximum', $resolved->properties->baz->oneOf[0]);
115110
}
116111

117112
public function testApplyConstraintsWithRecursiveReference()

0 commit comments

Comments
 (0)