public <A extends Annotation> A getTypeAnnotationConsideringHierarchy(ResolvedType targetType, Class<A> annotationType) {
        ResolvedType typeWithAnnotation = this.getTypeWithAnnotation(targetType, annotationType);
        if (typeWithAnnotation == null) {
            return null;
        }
        return typeWithAnnotation.getErasedType().getAnnotation(annotationType);
    }
Look-up the given annotation on the targeted type or one of its declared interfaces or super types.

@param <A> type of annotation to look for
@param targetType type to find annotation on (or on any of its declared interfaces or super types)
@param annotationType type of annotation to look for
@return annotation instance (or {@code null} if not found)

@since 4.28.0
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/TypeContext.java