| 1 |
/* |
| 2 |
* Asterisk -- An open source telephony toolkit. |
| 3 |
* |
| 4 |
* Copyright (C) 2013, Digium, Inc. |
| 5 |
* |
| 6 |
* See http://www.asterisk.org for more information about |
| 7 |
* the Asterisk project. Please do not directly contact |
| 8 |
* any of the maintainers of this project for assistance; |
| 9 |
* the project provides a web site, mailing lists and IRC |
| 10 |
* channels for your use. |
| 11 |
* |
| 12 |
* This program is free software, distributed under the terms of |
| 13 |
* the GNU General Public License Version 2. See the LICENSE file |
| 14 |
* at the top of the source tree. |
| 15 |
*/ |
| 16 |
|
| 17 |
/*! \file |
| 18 |
* |
| 19 |
* \brief Generated file - Build validators for ARI model objects. |
| 20 |
* |
| 21 |
* In addition to the normal validation functions one would normally expect, |
| 22 |
* each validator has a ast_ari_validate_{id}_fn() companion function that returns |
| 23 |
* the validator's function pointer. |
| 24 |
* |
| 25 |
* The reason for this seamingly useless indirection is the way function |
| 26 |
* pointers used to interfere with module loading. Previously, Asterisk |
| 27 |
* attempted to dlopen() each module using \c RTLD_LAZY in order to read some |
| 28 |
* metadata from the module. Using functions to get the function pointer |
| 29 |
* allowed us to be lazy. |
| 30 |
*/ |
| 31 |
|
| 32 |
/* |
| 33 |
{{> do-not-edit}} |
| 34 |
* This file is generated by a mustache template. Please see the original |
| 35 |
* template in rest-api-templates/ari_model_validators.h.mustache |
| 36 |
*/ |
| 37 |
|
| 38 |
#ifndef _ASTERISK_ARI_MODEL_H |
| 39 |
#define _ASTERISK_ARI_MODEL_H |
| 40 |
|
| 41 |
#include "asterisk/json.h" |
| 42 |
|
| 43 |
/*! @{ */ |
| 44 |
|
| 45 |
/*! |
| 46 |
* \brief Validator for native Swagger void. |
| 47 |
* |
| 48 |
* \param json JSON object to validate. |
| 49 |
* \retval True (non-zero) if valid. |
| 50 |
* \retval False (zero) if invalid. |
| 51 |
*/ |
| 52 |
int ast_ari_validate_void(struct ast_json *json); |
| 53 |
|
| 54 |
/*! |
| 55 |
* \brief Validator for native Swagger object. |
| 56 |
* |
| 57 |
* \param json JSON object to validate. |
| 58 |
* \retval True (non-zero) if valid. |
| 59 |
* \retval False (zero) if invalid. |
| 60 |
*/ |
| 61 |
int ast_ari_validate_object(struct ast_json *json); |
| 62 |
|
| 63 |
/*! |
| 64 |
* \brief Validator for native Swagger byte. |
| 65 |
* |
| 66 |
* \param json JSON object to validate. |
| 67 |
* \retval True (non-zero) if valid. |
| 68 |
* \retval False (zero) if invalid. |
| 69 |
*/ |
| 70 |
int ast_ari_validate_byte(struct ast_json *json); |
| 71 |
|
| 72 |
/*! |
| 73 |
* \brief Validator for native Swagger boolean. |
| 74 |
* |
| 75 |
* \param json JSON object to validate. |
| 76 |
* \retval True (non-zero) if valid. |
| 77 |
* \retval False (zero) if invalid. |
| 78 |
*/ |
| 79 |
int ast_ari_validate_boolean(struct ast_json *json); |
| 80 |
|
| 81 |
/*! |
| 82 |
* \brief Validator for native Swagger int. |
| 83 |
* |
| 84 |
* \param json JSON object to validate. |
| 85 |
* \retval True (non-zero) if valid. |
| 86 |
* \retval False (zero) if invalid. |
| 87 |
*/ |
| 88 |
int ast_ari_validate_int(struct ast_json *json); |
| 89 |
|
| 90 |
/*! |
| 91 |
* \brief Validator for native Swagger long. |
| 92 |
* |
| 93 |
* \param json JSON object to validate. |
| 94 |
* \retval True (non-zero) if valid. |
| 95 |
* \retval False (zero) if invalid. |
| 96 |
*/ |
| 97 |
int ast_ari_validate_long(struct ast_json *json); |
| 98 |
|
| 99 |
/*! |
| 100 |
* \brief Validator for native Swagger float. |
| 101 |
* |
| 102 |
* \param json JSON object to validate. |
| 103 |
* \retval True (non-zero) if valid. |
| 104 |
* \retval False (zero) if invalid. |
| 105 |
*/ |
| 106 |
int ast_ari_validate_float(struct ast_json *json); |
| 107 |
|
| 108 |
/*! |
| 109 |
* \brief Validator for native Swagger double. |
| 110 |
* |
| 111 |
* \param json JSON object to validate. |
| 112 |
* \retval True (non-zero) if valid. |
| 113 |
* \retval False (zero) if invalid. |
| 114 |
*/ |
| 115 |
int ast_ari_validate_double(struct ast_json *json); |
| 116 |
|
| 117 |
/*! |
| 118 |
* \brief Validator for native Swagger string. |
| 119 |
* |
| 120 |
* \param json JSON object to validate. |
| 121 |
* \retval True (non-zero) if valid. |
| 122 |
* \retval False (zero) if invalid. |
| 123 |
*/ |
| 124 |
int ast_ari_validate_string(struct ast_json *json); |
| 125 |
|
| 126 |
/*! |
| 127 |
* \brief Validator for native Swagger date. |
| 128 |
* |
| 129 |
* \param json JSON object to validate. |
| 130 |
* \retval True (non-zero) if valid. |
| 131 |
* \retval False (zero) if invalid. |
| 132 |
*/ |
| 133 |
int ast_ari_validate_date(struct ast_json *json); |
| 134 |
|
| 135 |
/*! |
| 136 |
* \brief Validator for a Swagger List[]/JSON array. |
| 137 |
* |
| 138 |
* \param json JSON object to validate. |
| 139 |
* \param fn Validator to call on every element in the array. |
| 140 |
* \retval True (non-zero) if valid. |
| 141 |
* \retval False (zero) if invalid. |
| 142 |
*/ |
| 143 |
int ast_ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *)); |
| 144 |
|
| 145 |
/*! @} */ |
| 146 |
|
| 147 |
/*! |
| 148 |
* \brief Function type for validator functions. Allows for |
| 149 |
*/ |
| 150 |
typedef int (*ari_validator)(struct ast_json *json); |
| 151 |
{{#apis}} |
| 152 |
{{#api_declaration}} |
| 153 |
{{#models}} |
| 154 |
|
| 155 |
/*! |
| 156 |
* \brief Validator for {{id}}. |
| 157 |
* |
| 158 |
* {{{description_dox}}} |
| 159 |
* |
| 160 |
* \param json JSON object to validate. |
| 161 |
* \retval True (non-zero) if valid. |
| 162 |
* \retval False (zero) if invalid. |
| 163 |
*/ |
| 164 |
int ast_ari_validate_{{c_id}}(struct ast_json *json); |
| 165 |
|
| 166 |
/*! |
| 167 |
* \brief Function pointer to ast_ari_validate_{{c_id}}(). |
| 168 |
*/ |
| 169 |
ari_validator ast_ari_validate_{{c_id}}_fn(void); |
| 170 |
{{/models}} |
| 171 |
{{/api_declaration}} |
| 172 |
{{/apis}} |
| 173 |
|
| 174 |
/* |
| 175 |
* JSON models |
| 176 |
* |
| 177 |
{{#apis}} |
| 178 |
{{#api_declaration}} |
| 179 |
{{#models}} |
| 180 |
* {{id}} |
| 181 |
{{#properties}} |
| 182 |
* - {{name}}: {{type.name}}{{#required}} (required){{/required}} |
| 183 |
{{/properties}} |
| 184 |
{{/models}} |
| 185 |
{{/api_declaration}} |
| 186 |
{{/apis}} */ |
| 187 |
|
| 188 |
#endif /* _ASTERISK_ARI_MODEL_H */ |