Skip to content

Commit aeb9def

Browse files
authored
Merge pull request #1013 from timemanx/feature/duplicate-example-warning
Elevate log level to WARNING when a conflicting Example is found
2 parents bdd359e + cc629ac commit aeb9def

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
7777
Schema existingModel = schemas.get(possiblyConflictingDefinitionName);
7878

7979
if (existingModel != null) {
80-
LOGGER.debug("A model for " + existingModel + " already exists");
80+
LOGGER.warn("A model for " + existingModel + " already exists");
8181
if(existingModel.get$ref() != null) {
8282
// use the new model
8383
existingModel = null;

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/processors/ExternalRefProcessorTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
import java.util.Map;
2222

2323
import static org.hamcrest.CoreMatchers.is;
24+
import static org.hamcrest.CoreMatchers.notNullValue;
2425
import static org.junit.Assert.assertThat;
2526
import static org.testng.Assert.assertEquals;
26-
import static org.testng.AssertJUnit.assertTrue;
2727

2828

2929
public class ExternalRefProcessorTest {
@@ -137,11 +137,11 @@ public void testNestedExternalRefs(@Injectable final Schema mockedModel){
137137
times = 1;
138138
}};
139139

140-
String actualRef = new ExternalRefProcessor(cache, testedOpenAPI).processRefToExternalSchema(customerURL, refFormat);
140+
new ExternalRefProcessor(cache, testedOpenAPI).processRefToExternalSchema(customerURL, refFormat);
141141

142-
assertTrue(testedOpenAPI.getComponents().getSchemas().get("Customer") != null);
143-
assertTrue(testedOpenAPI.getComponents().getSchemas().get("Contact") != null);
144-
assertTrue(testedOpenAPI.getComponents().getSchemas().get("Address") != null);
142+
assertThat(testedOpenAPI.getComponents().getSchemas().get("Customer"), notNullValue());
143+
assertThat(testedOpenAPI.getComponents().getSchemas().get("Contact"), notNullValue());
144+
assertThat(testedOpenAPI.getComponents().getSchemas().get("Address"), notNullValue());
145145
}
146146

147147

0 commit comments

Comments
 (0)