Skip to content
Snippets Groups Projects
  • Corey Farrell's avatar
    a6e5bae3
    Remove ASTERISK_REGISTER_FILE. · a6e5bae3
    Corey Farrell authored
    ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
    all traces of it.
    
    Previously exported symbols removed:
    * __ast_register_file
    * __ast_unregister_file
    * ast_complete_source_filename
    
    This also removes the mtx_prof static variable that was declared when
    MTX_PROFILE was enabled.  This variable was only used in lock.c so it
    is now initialized in that file only.
    
    ASTERISK-26480 #close
    
    Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
    a6e5bae3
    History
    Remove ASTERISK_REGISTER_FILE.
    Corey Farrell authored
    ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
    all traces of it.
    
    Previously exported symbols removed:
    * __ast_register_file
    * __ast_unregister_file
    * ast_complete_source_filename
    
    This also removes the mtx_prof static variable that was declared when
    MTX_PROFILE was enabled.  This variable was only used in lock.c so it
    is now initialized in that file only.
    
    ASTERISK-26480 #close
    
    Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
ari_model_validators.c.mustache 2.76 KiB
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 2013, Digium, Inc.
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

/*! \file
 *
 * \brief Generated file - Build validators for ARI model objects.
 */

 /*
{{> do-not-edit}}
 * This file is generated by a mustache template. Please see the original
 * template in rest-api-templates/ari_model_validators.c.mustache
 */

#include "asterisk.h"

#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "ari_model_validators.h"
{{#apis}}
{{#api_declaration}}
{{#models}}

int ast_ari_validate_{{c_id}}(struct ast_json *json)
{
	int res = 1;
	struct ast_json_iter *iter;
{{#properties}}
{{#required}}
	int has_{{name}} = 0;
{{/required}}
{{/properties}}
{{#has_subtypes}}
	const char *discriminator;

	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}}\n");
		return 0;
	}

	if (strcmp("{{id}}", discriminator) == 0) {
		/* Self type; fall through */
	} else
{{#all_subtypes}}
	if (strcmp("{{id}}", discriminator) == 0) {
		return ast_ari_validate_{{c_id}}(json);
	} else
{{/all_subtypes}}
	{
		ast_log(LOG_ERROR, "ARI {{id}} has undocumented subtype %s\n",
			discriminator);
		res = 0;
	}
{{/has_subtypes}}

	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {