@Override
    public JDocCommentable apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) {

        if (node.asBoolean()) {
            generatableType.javadoc().append("\n(Required)");

            if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations()
                    && generatableType instanceof JFieldVar) {
                final Class<? extends Annotation> notNullClass
                        = ruleFactory.getGenerationConfig().isUseJakartaValidation()
                        ? NotNull.class
                        : javax.validation.constraints.NotNull.class;
                ((JFieldVar) generatableType).annotate(notNullClass);
            }

            if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations()
                    && generatableType instanceof JFieldVar) {
                ((JFieldVar) generatableType).annotate(Nonnull.class);
            }
        } else {
            if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations()
                    && generatableType instanceof JFieldVar) {
                ((JFieldVar) generatableType).annotate(Nullable.class);
            }
        }

        return generatableType;
    }
@Test
    public void applyAddsTextWhenRequired() throws JClassAlreadyExistsException {

        JDefinedClass jclass = new JCodeModel()._class(TARGET_CLASS_NAME);

        ObjectMapper mapper = new ObjectMapper();
        BooleanNode descriptionNode = mapper.createObjectNode().booleanNode(true);

        JDocCommentable result = rule.apply("fooBar", descriptionNode, null, jclass, null);

        assertThat(result.javadoc(), sameInstance(jclass.javadoc()));
        assertThat(result.javadoc().size(), is(1));
        assertThat((String) result.javadoc().get(0), is("\n(Required)"));

    }