@Override
  public JType apply(String nodeName, JsonNode schemaNode, JsonNode parent, JClassContainer generatableType, Schema schema) {

    if (schemaNode.has("$ref")) {
      final String nameFromRef = nameFromRef(schemaNode.get("$ref").asText());

      schema = ruleFactory.getSchemaStore().create(schema, schemaNode.get("$ref").asText(), ruleFactory.getGenerationConfig().getRefFragmentPathDelimiters());
      schemaNode = schema.getContent();

      if (schema.isGenerated()) {
        return schema.getJavaType();
      }

      return apply(nameFromRef != null ? nameFromRef : nodeName, schemaNode, parent, generatableType, schema);
    }

    schema = schema.deriveChildSchema(schemaNode);

    JType javaType;
    if (schemaNode.has("enum")) {
      javaType = ruleFactory.getEnumRule().apply(nodeName, schemaNode, parent, generatableType, schema);
    } else {
      javaType = ruleFactory.getTypeRule().apply(nodeName, schemaNode, parent, generatableType.getPackage(), schema);
    }
    schema.setJavaTypeIfEmpty(javaType);
    if (schema.getJavaType() != javaType && javaType instanceof JDefinedClass) {
      JDefinedClass cls = (JDefinedClass)javaType;
      cls._package().remove(cls);
    }
    return schema.getJavaType();
  }
@Override
  public JType apply(String nodeName, JsonNode schemaNode, JsonNode parent, JClassContainer generatableType, Schema schema)