diff --git a/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java b/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java index d6321b5..4c21682 100644 --- a/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java +++ b/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java @@ -155,7 +155,7 @@ private void validateDefinition(String definitionName, Model actualDefinition, M schemaObjectResolver.resolvePropertiesFromExpected(expectedDefinition), definitionName); - if (expectedDefinition instanceof ModelImpl) { + if (expectedDefinition instanceof ModelImpl && actualDefinition instanceof ModelImpl) { validateDefinitionRequiredProperties(((ModelImpl) actualDefinition).getRequired(), ((ModelImpl) expectedDefinition).getRequired(), definitionName); diff --git a/src/main/java/io/github/robwin/swagger/test/DocumentationDrivenValidator.java b/src/main/java/io/github/robwin/swagger/test/DocumentationDrivenValidator.java index 71377e9..f1aecaa 100644 --- a/src/main/java/io/github/robwin/swagger/test/DocumentationDrivenValidator.java +++ b/src/main/java/io/github/robwin/swagger/test/DocumentationDrivenValidator.java @@ -154,7 +154,7 @@ private void validateDefinition(String definitionName, Model actualDefinition, M schemaObjectResolver.resolvePropertiesFromExpected(expectedDefinition), definitionName); - if (expectedDefinition instanceof ModelImpl) { + if (expectedDefinition instanceof ModelImpl && actualDefinition instanceof ModelImpl) { validateDefinitionRequiredProperties(((ModelImpl) actualDefinition).getRequired(), ((ModelImpl) expectedDefinition).getRequired(), definitionName);