@Override
        public List<ResolvedType> findSubtypes(ResolvedType declaredType, SchemaGenerationContext context) {
            if (declaredType.getErasedType() == Object.class) {
                return null;
            }
            ClassInfoList subtypes;
            if (declaredType.isInterface()) {
                subtypes = this.getScanResult().getClassesImplementing(declaredType.getErasedType());
            } else {
                subtypes = this.getScanResult().getSubclasses(declaredType.getErasedType());
            }
            if (!subtypes.isEmpty()) {
                TypeContext typeContext = context.getTypeContext();
                return subtypes.loadClasses(true)
                        .stream()
                        .map(subclass -> typeContext.resolveSubtype(declaredType, subclass))
                        .collect(Collectors.toList());
            }
            return null;
        }
Simple implementation of a reflection based subtype resolver, considering only subtypes from a certain package.
jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/SubtypeLookUpExample.java