Skip to content

Commit

Permalink
Merge pull request #1013 from timemanx/feature/duplicate-example-warning
Browse files Browse the repository at this point in the history
Elevate log level to WARNING when a conflicting Example is found
  • Loading branch information
gracekarina authored Mar 19, 2019
2 parents bdd359e + cc629ac commit aeb9def
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
Schema existingModel = schemas.get(possiblyConflictingDefinitionName);

if (existingModel != null) {
LOGGER.debug("A model for " + existingModel + " already exists");
LOGGER.warn("A model for " + existingModel + " already exists");
if(existingModel.get$ref() != null) {
// use the new model
existingModel = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import java.util.Map;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;


public class ExternalRefProcessorTest {
Expand Down Expand Up @@ -137,11 +137,11 @@ public void testNestedExternalRefs(@Injectable final Schema mockedModel){
times = 1;
}};

String actualRef = new ExternalRefProcessor(cache, testedOpenAPI).processRefToExternalSchema(customerURL, refFormat);
new ExternalRefProcessor(cache, testedOpenAPI).processRefToExternalSchema(customerURL, refFormat);

assertTrue(testedOpenAPI.getComponents().getSchemas().get("Customer") != null);
assertTrue(testedOpenAPI.getComponents().getSchemas().get("Contact") != null);
assertTrue(testedOpenAPI.getComponents().getSchemas().get("Address") != null);
assertThat(testedOpenAPI.getComponents().getSchemas().get("Customer"), notNullValue());
assertThat(testedOpenAPI.getComponents().getSchemas().get("Contact"), notNullValue());
assertThat(testedOpenAPI.getComponents().getSchemas().get("Address"), notNullValue());
}


Expand Down

0 comments on commit aeb9def

Please sign in to comment.