@Override
        public CustomDefinition provideCustomSchemaDefinition(ResolvedType javaType, SchemaGenerationContext context) {
            if (javaType.getErasedType().getSuperclass() == null || javaType.getErasedType().getSuperclass() == Object.class) {
                return null;
            }
            ResolvedType superType = context.getTypeContext().resolve(javaType.getErasedType().getSuperclass());
            // two options here:
            // 1. providing "null" as second parameter = multiple hierarchy levels are respected
            // 2. providing "this" as second parameter = only one hierarchy level is respected
            ObjectNode superTypeReference = context.createStandardDefinitionReference(superType, null);
            ObjectNode definition = context.createStandardDefinition(javaType, this);
            definition.withArray(context.getKeyword(SchemaKeyword.TAG_ALLOF))
                    .add(superTypeReference);
            return new CustomDefinition(definition, CustomDefinition.DefinitionType.STANDARD, CustomDefinition.AttributeInclusion.YES);
        }
Example created in response to <a href="https://github.com/victools/jsonschema-generator/issues/407">#407</a>.
<br>
Reference separate definitions for common super types. Show-casing capabilities; but not recommended due to risk of infinite loop.
jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/InheritanceRefExample.java