@Override
        public void overrideTypeAttributes(ObjectNode schemaNode, TypeScope scope, SchemaGenerationContext context) {
            SchemaCondition annotation = scope.getContext().getTypeAnnotationConsideringHierarchy(scope.getType(), SchemaCondition.class);
            if (annotation == null) {
                return;
            }
            ObjectNode conditionParentNode;
            if (schemaNode.has(context.getKeyword(SchemaKeyword.TAG_IF))
                    || schemaNode.has(context.getKeyword(SchemaKeyword.TAG_THEN))
                    || schemaNode.has(context.getKeyword(SchemaKeyword.TAG_ELSE))) {
                // add via allOf to avoid conflicts
                conditionParentNode = schemaNode.withArray(context.getKeyword(SchemaKeyword.TAG_ALLOF)).addObject();
            } else {
                conditionParentNode = schemaNode;
            }

            this.populate(conditionParentNode.putObject(context.getKeyword(SchemaKeyword.TAG_IF)), annotation.ifFulFilled(), context);
            if (annotation.thenExpect().length > 0) {
                ObjectNode thenNode = conditionParentNode.putObject(context.getKeyword(SchemaKeyword.TAG_THEN));
                Stream.of(annotation.thenExpect()).forEach(thenCondition -> this.populate(thenNode, thenCondition, context));
            }
            if (annotation.elseExpect().length > 0) {
                ObjectNode elseNode = conditionParentNode.putObject(context.getKeyword(SchemaKeyword.TAG_ELSE));
                Stream.of(annotation.elseExpect()).forEach(elseCondition -> this.populate(elseNode, elseCondition, context));
            }
        }
Example created in response to <a href="https://github.com/victools/jsonschema-generator/discussions/328">#328</a>.
<br/>
Creating "if"/"then"/"else" blocks via custom annotations, leveraging the Swagger @Schema annotation.
jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/IfThenElseExample.java