@Override
    public ObjectNode generateSchema() {
        SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_2020_12, OptionPreset.PLAIN_JSON);
        configBuilder.forFields().withDependentRequiresResolver(field -> Optional
                .ofNullable(field.getAnnotationConsideringFieldAndGetter(IfPresentAlsoRequire.class))
                .map(IfPresentAlsoRequire::value)
                .map(Arrays::asList)
                .orElse(null));
        SchemaGeneratorConfig config = configBuilder.build();
        SchemaGenerator generator = new SchemaGenerator(config);
        return generator.generateSchema(Example.class);
    }
Example created in response to <a href="https://github.com/victools/jsonschema-generator/issues/463">#463</a>.
<br/>
Demonstrating the use of "dependentRequired" by using a custom annotation.
jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/DependentRequiredExample.java