Merge "astobj2: Create function to copy weak proxied objects from container."
[asterisk/asterisk.git] / rest-api-templates / ari_model_validators.c.mustache
index 0e87f8e..cd77da9 100644 (file)
  /*
 {{> do-not-edit}}
  * This file is generated by a mustache template. Please see the original
- * template in rest-api-templates/ari_model_validators.h.mustache
+ * template in rest-api-templates/ari_model_validators.c.mustache
  */
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/logger.h"
 #include "asterisk/module.h"
 #include "ari_model_validators.h"
@@ -36,7 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 {{#api_declaration}}
 {{#models}}
 
-int ari_validate_{{c_id}}(struct ast_json *json)
+int ast_ari_validate_{{c_id}}(struct ast_json *json)
 {
        int res = 1;
        struct ast_json_iter *iter;
@@ -50,18 +48,18 @@ int ari_validate_{{c_id}}(struct ast_json *json)
 
        discriminator = ast_json_string_get(ast_json_object_get(json, "{{discriminator.name}}"));
        if (!discriminator) {
-               ast_log(LOG_ERROR, "ARI {{id}} missing required field {{discriminator.name}}");
+               ast_log(LOG_ERROR, "ARI {{id}} missing required field {{discriminator.name}}\n");
                return 0;
        }
 
        if (strcmp("{{id}}", discriminator) == 0) {
                /* Self type; fall through */
        } else
-{{#subtypes}}
+{{#all_subtypes}}
        if (strcmp("{{id}}", discriminator) == 0) {
-               return ari_validate_{{c_id}}(json);
+               return ast_ari_validate_{{c_id}}(json);
        } else
-{{/subtypes}}
+{{/all_subtypes}}
        {
                ast_log(LOG_ERROR, "ARI {{id}} has undocumented subtype %s\n",
                        discriminator);
@@ -78,12 +76,12 @@ int ari_validate_{{c_id}}(struct ast_json *json)
 {{/required}}
 {{#type}}
 {{#is_list}}
-                       prop_is_valid = ari_validate_list(
+                       prop_is_valid = ast_ari_validate_list(
                                ast_json_object_iter_value(iter),
-                               ari_validate_{{c_singular_name}});
+                               ast_ari_validate_{{c_singular_name}});
 {{/is_list}}
 {{^is_list}}
-                       prop_is_valid = ari_validate_{{c_name}}(
+                       prop_is_valid = ast_ari_validate_{{c_name}}(
                                ast_json_object_iter_value(iter));
 {{/is_list}}
 {{/type}}
@@ -112,6 +110,11 @@ int ari_validate_{{c_id}}(struct ast_json *json)
 {{/properties}}
        return res;
 }
+
+ari_validator ast_ari_validate_{{c_id}}_fn(void)
+{
+       return ast_ari_validate_{{c_id}};
+}
 {{/models}}
 {{/api_declaration}}
 {{/apis}}