Skip to content

Commit 992c4e3

Browse files
committed
Revert "OpenAPIHolderImpl.resolveExternalRef throws java.lang.IllegalStateException"
This reverts commit 34d4481.
1 parent 34d4481 commit 992c4e3

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

vertx-web-openapi/src/main/java/io/vertx/ext/web/openapi/impl/OpenAPIHolderImpl.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,15 @@ private void deepSubstituteForValidation(Object obj, JsonPointer scope,
263263
}
264264

265265
private Future<JsonObject> resolveExternalRef(final URI ref) {
266-
Promise<JsonObject> promise = Promise.promise();
267-
Future<JsonObject> previous = externalSolvingRefs.putIfAbsent(ref, promise.future());
268-
if (previous != null) {
269-
return previous;
270-
}
271-
Future<JsonObject> solvedRef = URIUtils.isRemoteURI(ref) ? solveRemoteRef(ref) : solveLocalRef(ref);
272-
solvedRef.compose(jsonObject -> {
273-
absolutePaths.put(ref, jsonObject);
274-
return walkAndSolve(jsonObject, ref).map(jsonObject);
275-
}).onComplete(promise);
276-
return promise.future();
266+
return externalSolvingRefs.computeIfAbsent(ref,
267+
uri ->
268+
((URIUtils.isRemoteURI(uri)) ? solveRemoteRef(uri) : solveLocalRef(uri))
269+
.compose(j -> {
270+
absolutePaths.put(uri, j); // Circular refs hell!
271+
return walkAndSolve(j, uri).map(j);
272+
})
273+
274+
);
277275
}
278276

279277
private Future<JsonObject> solveRemoteRef(final URI ref) {

0 commit comments

Comments
 (0)