Repository: joelittlejohn/jsonschema2pojo
Pull request #967 (2019-04-04 17:27:39)

Add support for including JsonTypeInfo Annotation
Add support for including the Jackson 1 & 2 JsonTypeInfo Annotation to generated classes.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d0c04fc..d99d55be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 1.0.1
+* Check schema required array before is required flag ([#964](https://github.com/joelittlejohn/jsonschema2pojo/pull/964))
+* Features/builders as inner classes ([#953](https://github.com/joelittlejohn/jsonschema2pojo/pull/953))
+
 ## 1.0.0
 * Don't register output directory as a set of files, since this breaks Gradle 5.0+ ([#940](https://github.com/joelittlejohn/jsonschema2pojo/pull/940))
 * **Builder method should be named consistently with getter/setter ([#905](https://github.com/joelittlejohn/jsonschema2pojo/issues/905))**
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 943d4323..08943003 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -95,3 +95,5 @@
 * Martin Bramwell
 * Jan Oopkaup
 * Michał Szymborski
+* Duane Zamrok
+* Gleb Averchuk
diff --git a/README.md b/README.md
index 1626d2c5..e420dcaf 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ A very simple Maven example:
 <plugin>
     <groupId>org.jsonschema2pojo</groupId>
     <artifactId>jsonschema2pojo-maven-plugin</artifactId>
-    <version>1.0.0</version>
+    <version>1.0.1</version>
     <configuration>
         <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
         <targetPackage>com.example.types</targetPackage>
@@ -32,9 +32,9 @@ Useful pages:
   * **[Getting started](https://github.com/joelittlejohn/jsonschema2pojo/wiki/Getting-Started)**
   * **[How to contribute](https://github.com/joelittlejohn/jsonschema2pojo/blob/master/CONTRIBUTING.md)**
   * [Reference](https://github.com/joelittlejohn/jsonschema2pojo/wiki/Reference)
-  * [Latest Javadocs](https://joelittlejohn.github.io/jsonschema2pojo/javadocs/1.0.0/)
-  * [Documentation for the Maven plugin](https://joelittlejohn.github.io/jsonschema2pojo/site/1.0.0/generate-mojo.html)
-  * [Documentation for the Ant task](https://joelittlejohn.github.io/jsonschema2pojo/site/1.0.0/Jsonschema2PojoTask.html)
+  * [Latest Javadocs](https://joelittlejohn.github.io/jsonschema2pojo/javadocs/1.0.1/)
+  * [Documentation for the Maven plugin](https://joelittlejohn.github.io/jsonschema2pojo/site/1.0.1/generate-mojo.html)
+  * [Documentation for the Ant task](https://joelittlejohn.github.io/jsonschema2pojo/site/1.0.1/Jsonschema2PojoTask.html)
 
 Project resources:
   * [Downloads](https://github.com/joelittlejohn/jsonschema2pojo/releases)
diff --git a/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java b/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java
index 4bcbe11f..e629b9e0 100644
--- a/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java
+++ b/jsonschema2pojo-ant/src/main/java/org/jsonschema2pojo/ant/Jsonschema2PojoTask.java
@@ -69,6 +69,8 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {
 
     private boolean generateBuilders;
 
+    private boolean includeTypeInfo = false;
+
     private boolean useInnerClassBuilders = false;
 
     private boolean includeConstructors = false;
@@ -302,6 +304,22 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {
         this.generateBuilders = generateBuilders;
     }
 
+    /**
+     * Sets the 'includeTypeInfo' property of this class.
+     *
+     * @param includeTypeInfo
+     *            Whether to use include json type info information to class. Often required to support polymorphic type deserialization.
+     *            <p>
+     *            By default the type information is stored in the @class property, this can be overridden in the deserializationClassProperty of the schema.
+     *            <p>
+     *            Default: <code>false</code>.
+     *
+     * @see <a href="Jackson Polymorphic Deserialization">https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization</a>
+     */
+    public void setIncludeTypeInfo(boolean includeTypeInfo) {
+        this.includeTypeInfo = includeTypeInfo;
+    }
+
     /**
      * Sets the 'usePrimitives' property of this class.
      *
@@ -892,6 +910,12 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {
         return generateBuilders;
     }
 
+    @Override
+    public boolean isIncludeTypeInfo()
+    {
+        return includeTypeInfo;
+    }
+
     @Override
     public boolean isUsePrimitives() {
         return usePrimitives;
diff --git a/jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html b/jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
index cf725b08..9677d9da 100644
--- a/jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
+++ b/jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
@@ -156,9 +156,17 @@
         </td>
         <td align="center" valign="top">No (default <code>false</code>)</td>
     </tr>
+    <tr>
+        <td valign="top">includeTypeInfo</td>
+        <td valign="top">
+            <p>Whether to include json type information; often required to support polymorphic type handling.</p>
+            <p>By default the type information is stored in the @class property, this can be overridden in the deserializationClassProperty of the schema.</p>
+        </td>
+        <td align="center" valign="top">No (default <code>false</code>)</td>
+    </tr>
     <tr>
         <td valign="top">useInnerClassBuilders</td>
-        <td valign="top">Determines whether builders will be chainable setters or embedded classes when generateBuilders is used</td>
+        <td valign="top">Determines whether builders will be chainable setters or embedded classes when generateBuilders is used.</td>
         <td align="center" valign="top">No (default <code>false</code>)</td>
     </tr>
     <tr>
diff --git a/jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Arguments.java b/jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Arguments.java
index 9f6704e5..861c82c7 100644
--- a/jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Arguments.java
+++ b/jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/Arguments.java
@@ -63,6 +63,9 @@ public class Arguments implements GenerationConfig {
     @Parameter(names = { "-b", "--generate-builders" }, description = "Generate builder-style methods as well as setters")
     private boolean generateBuilderMethods = false;
 
+    @Parameter(names = { "--include-type-info" }, description = "Include json type info; required to support polymorphic type handling. https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization")
+    private boolean includeTypeInfo = false;
+
     @Parameter(names = { "--use-inner-class-builders" }, description = "Generate an inner class with builder-style methods")
     private boolean useInnerClassBuilders = false;
 
@@ -281,6 +284,12 @@ public class Arguments implements GenerationConfig {
         return generateBuilderMethods;
     }
 
+    @Override
+    public boolean isIncludeTypeInfo()
+    {
+        return includeTypeInfo;
+    }
+
     @Override
     public boolean isUseInnerClassBuilders() {
         return useInnerClassBuilders;
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractAnnotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractAnnotator.java
index 9b17cc30..081cd8f9 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractAnnotator.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractAnnotator.java
@@ -41,6 +41,11 @@ public abstract class AbstractAnnotator implements Annotator {
         this.generationConfig = generationConfig;
     }
 
+    @Override
+    public void typeInfo(JDefinedClass clazz, JsonNode schema) {
+
+    }
+
     @Override
     public void propertyOrder(JDefinedClass clazz, JsonNode propertiesNode) {
     }
@@ -91,6 +96,11 @@ public abstract class AbstractAnnotator implements Annotator {
     public void additionalPropertiesField(JFieldVar field, JDefinedClass clazz, String propertyName) {
     }
 
+    @Override
+    public boolean isPolymorphicDeserializationSupported(JsonNode node) {
+        return false;
+    }
+
     public GenerationConfig getGenerationConfig() {
         return generationConfig;
     }
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractTypeInfoAwareAnnotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractTypeInfoAwareAnnotator.java
new file mode 100644
index 00000000..5c3179c9
--- /dev/null
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AbstractTypeInfoAwareAnnotator.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2010-2017 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jsonschema2pojo;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.codemodel.JDefinedClass;
+
+public abstract class AbstractTypeInfoAwareAnnotator extends AbstractAnnotator
+{
+	public AbstractTypeInfoAwareAnnotator(GenerationConfig generationConfig) {
+		super(generationConfig);
+	}
+
+	@Override
+	public void typeInfo(JDefinedClass clazz, JsonNode node) {
+		if(getGenerationConfig().isIncludeTypeInfo()) {
+			// Have per-schema JavaTypeInfo configuration override what is defined in generation config; backward comparability
+			if (node.has("deserializationClassProperty")) {
+				String annotationName = node.get("deserializationClassProperty").asText();
+				addJsonTypeInfoAnnotation(clazz, annotationName);
+			} else {
+				addJsonTypeInfoAnnotation(clazz, "@class");
+			}
+		} else {
+			// per-schema JsonTypeInfo configuration
+			if (node.has("deserializationClassProperty")) {
+				String annotationName = node.get("deserializationClassProperty").asText();
+				addJsonTypeInfoAnnotation(clazz, annotationName);
+			}
+		}
+	}
+
+	@Override
+	public boolean isPolymorphicDeserializationSupported(JsonNode node) {
+		return getGenerationConfig().isIncludeTypeInfo() || node.has("deserializationClassProperty");
+	}
+
+	abstract protected void addJsonTypeInfoAnnotation(JDefinedClass clazz, String propertyName);
+}
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java
index ee6dbf32..65498c7a 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Annotator.java
@@ -32,6 +32,20 @@ import com.sun.codemodel.JMethod;
  */
 public interface Annotator {
 
+    /**
+     * Add the necessary annotation to dictate correct type information during
+     * serialization and deserialization; often required with polymorphic types.
+     *
+     * @see <a
+      *      href="https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization">Jackson Docs - Polymorphic Type Handling</a>
+     *
+     * @param clazz
+     *            a generated pojo class, that is serialized to JSON
+     * @param schema
+     *            the object schema associated with this clazz
+     */
+    void typeInfo(JDefinedClass clazz, JsonNode schema);
+
     /**
      * Add the necessary annotation to dictate correct property order during
      * serialization
@@ -195,4 +209,6 @@ public interface Annotator {
     void timeField(JFieldVar field, JDefinedClass clazz, JsonNode propertyNode);
 
     void additionalPropertiesField(JFieldVar field, JDefinedClass clazz, String propertyName);
+
+	boolean isPolymorphicDeserializationSupported(JsonNode node);
 }
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/CompositeAnnotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/CompositeAnnotator.java
index 21d68062..393dbb96 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/CompositeAnnotator.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/CompositeAnnotator.java
@@ -43,6 +43,13 @@ public class CompositeAnnotator implements Annotator {
         this.annotators = annotators;
     }
 
+    @Override
+    public void typeInfo(JDefinedClass clazz, JsonNode node) {
+        for (Annotator annotator : annotators) {
+            annotator.typeInfo(clazz, node);
+        }
+    }
+
     @Override
     public void propertyOrder(JDefinedClass clazz, JsonNode propertiesNode) {
         for (Annotator annotator : annotators) {
@@ -130,7 +137,17 @@ public class CompositeAnnotator implements Annotator {
         }
     }
 
-   @Override
+    @Override
+    public boolean isPolymorphicDeserializationSupported(JsonNode node) {
+        for (Annotator annotator : annotators) {
+            if (!annotator.isPolymorphicDeserializationSupported(node)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
    public void dateTimeField(JFieldVar field, JDefinedClass clazz, JsonNode propertyNode) {
       for (Annotator annotator : annotators) {
             annotator.dateTimeField(field, clazz, propertyNode);
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/DefaultGenerationConfig.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/DefaultGenerationConfig.java
index 068a853d..ba088633 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/DefaultGenerationConfig.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/DefaultGenerationConfig.java
@@ -38,6 +38,15 @@ public class DefaultGenerationConfig implements GenerationConfig {
         return false;
     }
 
+    /**
+     * @return <code>false</code>
+     */
+    @Override
+    public boolean isIncludeTypeInfo()
+    {
+        return false;
+    }
+
     /**
      * @return <code>false</code>
      */
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java
index ec27b894..48d7f4d7 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/GenerationConfig.java
@@ -43,6 +43,16 @@ public interface GenerationConfig {
     boolean isGenerateBuilders();
 
     /**
+     * Gets the 'includeTypeInfo' configuration option.
+     *
+     * @return whether to include json type information. Commonly used to support polymorphic type deserialization.
+     *
+     * @see <a href="Jackson Polymorphic Deserialization">https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization</a>
+     *
+     */
+	boolean isIncludeTypeInfo();
+
+	/**
      * Gets the 'usePrimitives' configuration option.
      *
      * @return whether to use primitives (<code>long</code>, <code>double</code>
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson1Annotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson1Annotator.java
index cd5720a1..bc59af11 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson1Annotator.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson1Annotator.java
@@ -20,12 +20,15 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import com.sun.codemodel.JAnnotationUse;
+import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jackson.annotate.JsonAnyGetter;
 import org.codehaus.jackson.annotate.JsonAnySetter;
 import org.codehaus.jackson.annotate.JsonCreator;
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.annotate.JsonPropertyOrder;
+import org.codehaus.jackson.annotate.JsonTypeInfo;
 import org.codehaus.jackson.annotate.JsonValue;
 import org.codehaus.jackson.map.annotate.JsonDeserialize;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -42,7 +45,7 @@ import com.sun.codemodel.JMethod;
  *
  * @see <a href="http://jackson.codehaus.org/">http://jackson.codehaus.org/</a>
  */
-public class Jackson1Annotator extends AbstractAnnotator {
+public class Jackson1Annotator extends AbstractTypeInfoAwareAnnotator {
 
     private final JsonSerialize.Inclusion inclusionLevel;
 
@@ -140,4 +143,14 @@ public class Jackson1Annotator extends AbstractAnnotator {
         field.annotate(JsonIgnore.class);
     }
 
+    protected void addJsonTypeInfoAnnotation(JDefinedClass jclass, String propertyName) {
+        JAnnotationUse jsonTypeInfo = jclass.annotate(JsonTypeInfo.class);
+        jsonTypeInfo.param("use", JsonTypeInfo.Id.CLASS);
+        jsonTypeInfo.param("include", JsonTypeInfo.As.PROPERTY);
+
+        // When not provided it will use default provided by "use" attribute
+        if(StringUtils.isNotBlank(propertyName)) {
+            jsonTypeInfo.param("property", propertyName);
+        }
+    }
 }
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson2Annotator.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson2Annotator.java
index 6678e949..d325e874 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson2Annotator.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/Jackson2Annotator.java
@@ -22,6 +22,9 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.sun.codemodel.JAnnotationUse;
+import org.apache.commons.lang3.StringUtils;
 import org.jsonschema2pojo.rules.FormatRule;
 
 import com.fasterxml.jackson.annotation.JsonAnyGetter;
@@ -49,7 +52,7 @@ import com.sun.codemodel.JMethod;
  * @see <a
  *      href="https://github.com/FasterXML/jackson-annotations">https://github.com/FasterXML/jackson-annotations</a>
  */
-public class Jackson2Annotator extends AbstractAnnotator {
+public class Jackson2Annotator extends AbstractTypeInfoAwareAnnotator {
 
     private final JsonInclude.Include inclusionLevel;
 
@@ -213,4 +216,15 @@ public class Jackson2Annotator extends AbstractAnnotator {
             field.annotate(JsonFormat.class).param("shape", JsonFormat.Shape.STRING).param("pattern", pattern).param("timezone", timezone);
         }
     }
+
+    protected void addJsonTypeInfoAnnotation(JDefinedClass jclass, String propertyName) {
+        JAnnotationUse jsonTypeInfo = jclass.annotate(JsonTypeInfo.class);
+        jsonTypeInfo.param("use", JsonTypeInfo.Id.CLASS);
+        jsonTypeInfo.param("include", JsonTypeInfo.As.PROPERTY);
+
+        // When not provided it will use default provided by "use" attribute
+        if(StringUtils.isNotBlank(propertyName)) {
+            jsonTypeInfo.param("property", propertyName);
+        }
+    }
 }
diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java
index b193abba..d347b169 100644
--- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java
+++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/ObjectRule.java
@@ -21,10 +21,8 @@ import static org.jsonschema2pojo.rules.PrimitiveTypes.isPrimitive;
 import static org.jsonschema2pojo.rules.PrimitiveTypes.primitiveType;
 import static org.jsonschema2pojo.util.TypeUtil.resolveType;
 
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.codemodel.ClassType;
-import com.sun.codemodel.JAnnotationUse;
 import com.sun.codemodel.JBlock;
 import com.sun.codemodel.JClass;
 import com.sun.codemodel.JClassAlreadyExistsException;
@@ -46,7 +44,9 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+
 import org.jsonschema2pojo.AnnotationStyle;
+import org.jsonschema2pojo.Annotator;
 import org.jsonschema2pojo.Schema;
 import org.jsonschema2pojo.exception.ClassAlreadyExistsException;
 import org.jsonschema2pojo.exception.GenerationException;
@@ -99,10 +99,6 @@ public class ObjectRule implements Rule<JPackage, JType> {
 
         schema.setJavaTypeIfEmpty(jclass);
 
-        if (node.has("deserializationClassProperty")) {
-            addJsonTypeInfoAnnotation(jclass, node);
-        }
-
         if (node.has("title")) {
             ruleFactory.getTitleRule().apply(nodeName, node.get("title"), node, jclass, schema);
         }
@@ -195,6 +191,8 @@ public class ObjectRule implements Rule<JPackage, JType> {
 
         JDefinedClass newType;
 
+        Annotator annotator = ruleFactory.getAnnotator();
+
         try {
             if (node.has("existingJavaType")) {
                 String fqn = substringBefore(node.get("existingJavaType").asText(), "<");
@@ -207,7 +205,8 @@ public class ObjectRule implements Rule<JPackage, JType> {
                 throw new ClassAlreadyExistsException(existingClass);
             }
 
-            boolean usePolymorphicDeserialization = usesPolymorphicDeserialization(node);
+            boolean usePolymorphicDeserialization = annotator.isPolymorphicDeserializationSupported(node);
+
             if (node.has("javaType")) {
                 String fqn = node.path("javaType").asText();
 
@@ -240,22 +239,13 @@ public class ObjectRule implements Rule<JPackage, JType> {
             throw new ClassAlreadyExistsException(e.getExistingClass());
         }
 
-        ruleFactory.getAnnotator().propertyInclusion(newType, node);
+        annotator.typeInfo(newType, node);
+        annotator.propertyInclusion(newType, node);
 
         return newType;
 
     }
 
-    private void addJsonTypeInfoAnnotation(JDefinedClass jclass, JsonNode node) {
-        if (ruleFactory.getGenerationConfig().getAnnotationStyle() == AnnotationStyle.JACKSON2) {
-            String annotationName = node.get("deserializationClassProperty").asText();
-            JAnnotationUse jsonTypeInfo = jclass.annotate(JsonTypeInfo.class);
-            jsonTypeInfo.param("use", JsonTypeInfo.Id.CLASS);
-            jsonTypeInfo.param("include", JsonTypeInfo.As.PROPERTY);
-            jsonTypeInfo.param("property", annotationName);
-        }
-    }
-
     private void addToString(JDefinedClass jclass) {
         Map<String, JFieldVar> fields = jclass.fields();
         JMethod toString = jclass.method(JMod.PUBLIC, String.class, "toString");
@@ -521,9 +511,15 @@ public class ObjectRule implements Rule<JPackage, JType> {
     }
 
     private boolean usesPolymorphicDeserialization(JsonNode node) {
-        if (ruleFactory.getGenerationConfig().getAnnotationStyle() == AnnotationStyle.JACKSON2) {
-            return node.has("deserializationClassProperty");
+
+        AnnotationStyle annotationStyle = ruleFactory.getGenerationConfig().getAnnotationStyle();
+
+        if (annotationStyle == AnnotationStyle.JACKSON
+                || annotationStyle == AnnotationStyle.JACKSON1
+                || annotationStyle == AnnotationStyle.JACKSON2) {
+            return ruleFactory.getGenerationConfig().isIncludeTypeInfo() || node.has("deserializationClassProperty");
         }
+
         return false;
     }
 
diff --git a/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaExtension.groovy b/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaExtension.groovy
index 4b570103..6b286614 100644
--- a/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaExtension.groovy
+++ b/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaExtension.groovy
@@ -45,6 +45,7 @@ public class JsonSchemaExtension implements GenerationConfig {
   Class<? extends Annotator> customAnnotator
   Class<? extends RuleFactory> customRuleFactory
   boolean generateBuilders
+  boolean includeJsonTypeInfoAnnotation
   boolean useInnerClassBuilders
   boolean includeGetters
   boolean includeSetters
@@ -96,6 +97,7 @@ public class JsonSchemaExtension implements GenerationConfig {
   public JsonSchemaExtension() {
     // See DefaultGenerationConfig
     generateBuilders = false
+    includeJsonTypeInfoAnnotation = false
     useInnerClassBuilders = false
     usePrimitives = false
     sourceFiles = []
@@ -150,6 +152,11 @@ public class JsonSchemaExtension implements GenerationConfig {
     formatTypeMapping = Collections.emptyMap()
   }
 
+  @Override
+  boolean isIncludeTypeInfo() {
+    return includeJsonTypeInfoAnnotation
+  }
+
   @Override
   public Iterator<URL> getSource() {
     def urlList = []
@@ -203,6 +210,7 @@ public class JsonSchemaExtension implements GenerationConfig {
   @Override
   public String toString() {
     """|generateBuilders = ${generateBuilders}
+       |includeJsonTypeInfoAnnotation = ${includeJsonTypeInfoAnnotation}
        |usePrimitives = ${usePrimitives}
        |source = ${sourceFiles}
        |targetDirectory = ${targetDirectory}
@@ -261,7 +269,7 @@ public class JsonSchemaExtension implements GenerationConfig {
   }
   
   public boolean isFormatDateTimes() {
-    return formatDateTimes;
+    return formatDateTimes
   }
 
 }
diff --git a/jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/Jsonschema2PojoMojo.java b/jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/Jsonschema2PojoMojo.java
index 4a065a3b..75577316 100644
--- a/jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/Jsonschema2PojoMojo.java
+++ b/jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/Jsonschema2PojoMojo.java
@@ -112,6 +112,17 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
      */
     private boolean generateBuilders = false;
 
+    /**
+     * Whether to include json type information; often required to support polymorphic type handling.
+     *
+     * By default the type information is stored in the @class property, this can be overridden in the deserializationClassProperty
+     * of the schema.
+     *
+     * @parameter property="jsonschema2pojo.includeTypeInfo"
+     *            default-value="false"
+     * @since 1.0.2
+     */
+    private boolean includeTypeInfo = false;
     /**
      * Whether to use primitives (<code>long</code>, <code>double</code>,
      * <code>boolean</code>) instead of wrapper types where possible when
@@ -752,7 +763,6 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
      */
     private boolean useInnerClassBuilders = false;
 
-
     /**
      * Executes the plugin, to read the given source and behavioural properties
      * and generate POJOs. The current implementation acts as a wrapper around
@@ -852,6 +862,12 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
         return generateBuilders;
     }
 
+    @Override
+    public boolean isIncludeTypeInfo()
+    {
+        return includeTypeInfo;
+    }
+
     @Override
     public File getTargetDirectory() {
         return outputDirectory;
diff --git a/pom.xml b/pom.xml
index 46596f72..3f091283 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,8 +54,8 @@
         <gradle.version>1.6</gradle.version>
         <gson.version>2.5</gson.version>
         <moshi.version>1.5.0</moshi.version>
-        <jackson2x.version>2.9.7</jackson2x.version>
-        <scala.version>2.11.6</scala.version>
+        <jackson2x.version>2.9.8</jackson2x.version>
+        <scala.version>2.11.12</scala.version>
     </properties>
 
     <build>


Test patch:
diff --git a/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/PolymorphicIT.java b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/PolymorphicIT.java
index ea7e4996..8381242d 100644
--- a/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/PolymorphicIT.java
+++ b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/PolymorphicIT.java
@@ -32,7 +32,10 @@
 package org.jsonschema2pojo.integration;
 
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import static org.jsonschema2pojo.integration.util.CodeGenerationHelper.config;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import org.jsonschema2pojo.integration.util.Jsonschema2PojoRule;
 import org.junit.Rule;
@@ -46,7 +49,7 @@ public class PolymorphicIT {
     @Rule public Jsonschema2PojoRule schemaRule = new Jsonschema2PojoRule();
     
     @Test
-    public void extendsWithPolymorphicDeserialization() throws ClassNotFoundException {
+    public void extendsWithPolymorphicDeserializationWithDefaultAnnotationStyle() throws ClassNotFoundException {
 
         ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/polymorphic/extendsSchema.json", "com.example");
 
@@ -54,6 +57,32 @@ public class PolymorphicIT {
         Class<?> supertype = subtype.getSuperclass();
 
         assertNotNull(supertype.getAnnotation(JsonTypeInfo.class));
+		assertNull(supertype.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+    }
+
+	@Test
+	public void extendsWithPolymorphicDeserializationWithJackson2() throws ClassNotFoundException {
+
+		ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/polymorphic/extendsSchema.json", "com.example",
+																	   config("annotationStyle", "JACKSON2"));
+
+		Class<?> subtype = resultsClassLoader.loadClass("com.example.ExtendsSchema");
+		Class<?> supertype = subtype.getSuperclass();
+
+		assertNotNull(supertype.getAnnotation(JsonTypeInfo.class));
+		assertNull(supertype.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+	}
+
+    @Test
+    public void extendsWithPolymorphicDeserializationWithJackson1() throws ClassNotFoundException {
+
+        ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/polymorphic/extendsSchema.json", "com.example",
+                                                                       config("annotationStyle", "JACKSON1"));
+
+        Class<?> subtype = resultsClassLoader.loadClass("com.example.ExtendsSchema");
+        Class<?> supertype = subtype.getSuperclass();
 
+        assertNotNull(supertype.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+		assertNull(supertype.getAnnotation(JsonTypeInfo.class));
     }
 }
diff --git a/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/CustomAnnotatorIT.java b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/CustomAnnotatorIT.java
index a38f969e..993c1292 100644
--- a/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/CustomAnnotatorIT.java
+++ b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/CustomAnnotatorIT.java
@@ -111,6 +111,11 @@ public class CustomAnnotatorIT {
      */
     public static class DeprecatingAnnotator implements Annotator {
 
+        @Override
+        public void typeInfo(JDefinedClass clazz, JsonNode schema) {
+
+        }
+
         @Override
         public void propertyOrder(JDefinedClass clazz, JsonNode propertiesNode) {
             clazz.annotate(Deprecated.class);
@@ -172,6 +177,11 @@ public class CustomAnnotatorIT {
 
         }
 
+        @Override
+        public boolean isPolymorphicDeserializationSupported(JsonNode node) {
+            return false;
+        }
+
         @Override
         public void dateField(JFieldVar field, JDefinedClass clazz, JsonNode propertyNode) {
             field.annotate(Deprecated.class);
diff --git a/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/IncludeTypeInfoIT.java b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/IncludeTypeInfoIT.java
new file mode 100644
index 00000000..bfaa9316
--- /dev/null
+++ b/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config/IncludeTypeInfoIT.java
@@ -0,0 +1,227 @@
+/**
+ * Copyright Â© 2010-2017 Nokia
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jsonschema2pojo.integration.config;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import org.jsonschema2pojo.integration.util.Jsonschema2PojoRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.jsonschema2pojo.integration.util.CodeGenerationHelper.config;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+
+public class IncludeTypeInfoIT
+{
+	@Rule
+	public Jsonschema2PojoRule schemaRule = new Jsonschema2PojoRule();
+
+	@Test
+	public void defaultConfig() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example");
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+	}
+
+	@Test
+	public void defaultJackson1() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example",
+																config("annotationStyle", "JACKSON1"));
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+	}
+
+	@Test
+	public void defaultJackson1WithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example",
+																config("annotationStyle", "JACKSON1"));
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNotNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		org.codehaus.jackson.annotate.JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(org.codehaus.jackson.annotate.JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(org.codehaus.jackson.annotate.JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+
+	@Test
+	public void defaultWithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example");
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNotNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+
+	@Test
+	public void disabled() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example",
+																config("includeTypeInfo", false));
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+	}
+
+	@Test
+	public void disabledJackson1() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example",
+																config("annotationStyle", "JACKSON1",
+																	   "includeTypeInfo", false));
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+	}
+
+	@Test
+	public void disabledJackson1WithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example",
+																config("annotationStyle", "JACKSON1",
+																	   "includeTypeInfo", false));
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNotNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		org.codehaus.jackson.annotate.JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(org.codehaus.jackson.annotate.JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(org.codehaus.jackson.annotate.JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+
+	@Test
+	public void disabledWithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example",
+																config("includeTypeInfo", false));
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNotNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+
+	@Test
+	public void enabled() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example",
+																config("includeTypeInfo", true));
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNotNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@class"));
+	}
+
+	@Test
+	public void enabledJackson1() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfo.json", "com.example",
+																config("annotationStyle", "JACKSON1",
+																	   "includeTypeInfo", true));
+
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfo");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNotNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		org.codehaus.jackson.annotate.JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(org.codehaus.jackson.annotate.JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(org.codehaus.jackson.annotate.JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@class"));
+	}
+
+	@Test
+	public void enabledJackson1WithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example",
+																config("annotationStyle", "JACKSON1",
+																	   "includeTypeInfo", true));
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNotNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		org.codehaus.jackson.annotate.JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(org.codehaus.jackson.annotate.JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(org.codehaus.jackson.annotate.JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+
+	@Test
+	public void enabledWithSchemaProperty() throws ClassNotFoundException
+	{
+
+		ClassLoader classLoader = schemaRule.generateAndCompile("/schema/typeInfo/typeInfoWithSchemaProperty.json", "com.example",
+																config("includeTypeInfo", true));
+		Class<?> classWithTypeInfo = classLoader.loadClass("com.example.TypeInfoWithSchemaProperty");
+
+		assertNotNull(classWithTypeInfo.getAnnotation(JsonTypeInfo.class));
+		assertNull(classWithTypeInfo.getAnnotation(org.codehaus.jackson.annotate.JsonTypeInfo.class));
+
+		JsonTypeInfo jsonTypeInfo = classWithTypeInfo.getAnnotation(JsonTypeInfo.class);
+		assertThat(jsonTypeInfo.use(), is(JsonTypeInfo.Id.CLASS));
+		assertThat(jsonTypeInfo.include(), is(JsonTypeInfo.As.PROPERTY));
+		assertThat(jsonTypeInfo.property(), is("@clazz"));
+	}
+}
diff --git a/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfo.json b/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfo.json
new file mode 100644
index 00000000..5c649ee4
--- /dev/null
+++ b/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfo.json
@@ -0,0 +1,4 @@
+{
+  "type" : "object",
+  "properties" : {}
+}
\ No newline at end of file
diff --git a/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfoWithSchemaProperty.json b/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfoWithSchemaProperty.json
new file mode 100644
index 00000000..b51c7b3a
--- /dev/null
+++ b/jsonschema2pojo-integration-tests/src/test/resources/schema/typeInfo/typeInfoWithSchemaProperty.json
@@ -0,0 +1,5 @@
+{
+  "type" : "object",
+  "deserializationClassProperty": "@clazz",
+  "properties" : {}
+}
\ No newline at end of file
diff --git a/jsonschema2pojo-maven-plugin/src/test/resources/example/pom.xml b/jsonschema2pojo-maven-plugin/src/test/resources/example/pom.xml
index 5d4fca6d..2849b96b 100644
--- a/jsonschema2pojo-maven-plugin/src/test/resources/example/pom.xml
+++ b/jsonschema2pojo-maven-plugin/src/test/resources/example/pom.xml
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.9.7</version>
+            <version>2.9.8</version>
         </dependency>
     </dependencies>
 
diff --git a/jsonschema2pojo-maven-plugin/src/test/resources/filtered/pom.xml b/jsonschema2pojo-maven-plugin/src/test/resources/filtered/pom.xml
index 4cf290f4..3caf0d30 100644
--- a/jsonschema2pojo-maven-plugin/src/test/resources/filtered/pom.xml
+++ b/jsonschema2pojo-maven-plugin/src/test/resources/filtered/pom.xml
@@ -43,7 +43,7 @@
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
-            <version>2.9.7</version>
+            <version>2.9.8</version>
         </dependency>
     </dependencies>