From cddcc111475e0ace54ce466f836fb1899c57fbd4 Mon Sep 17 00:00:00 2001 From: Emad89 <35974227+Emad89@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:54:46 +0100 Subject: [PATCH] Update ExternalRefProcessor.java Fix Duplicated objects --- .../swagger/v3/parser/processors/ExternalRefProcessor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java index 6edc05d5cc..8be30f63f2 100644 --- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java +++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java @@ -79,7 +79,14 @@ private String finalNameRec(Map schemas, String possiblyConflict return tryName; } + private String normalizeRelativeRef(String $ref, RefFormat refFormat) { + if (refFormat == RefFormat.RELATIVE && !$ref.startsWith("./")) { + return "./" + $ref; + } + return $ref; + } public String processRefToExternalSchema(String $ref, RefFormat refFormat) { + $ref = normalizeRelativeRef($ref, refFormat); String renamedRef = cache.getRenamedRef($ref); if(renamedRef != null) { return renamedRef;