123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- /*
- * 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.
- *
- * In addition to the normal validation functions one would normally expect,
- * each validator has a ast_ari_validate_{id}_fn() companion function that returns
- * the validator's function pointer.
- *
- * The reason for this seamingly useless indirection is the way function
- * pointers interfere with module loading. Asterisk attempts to dlopen() each
- * module using \c RTLD_LAZY in order to read some metadata from the module.
- * Unfortunately, if you take the address of a function, the function has to be
- * resolvable at load time, even if \c RTLD_LAZY is specified. By moving the
- * function-address-taking into this module, we can once again be lazy.
- */
- /*
- {{> 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
- */
- #ifndef _ASTERISK_ARI_MODEL_H
- #define _ASTERISK_ARI_MODEL_H
- #include "asterisk/json.h"
- /*! @{ */
- /*!
- * \brief Validator for native Swagger void.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_void(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger object.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_object(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger byte.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_byte(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger boolean.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_boolean(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger int.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_int(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger long.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_long(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger float.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_float(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger double.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_double(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger string.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_string(struct ast_json *json);
- /*!
- * \brief Validator for native Swagger date.
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_date(struct ast_json *json);
- /*!
- * \brief Validator for a Swagger List[]/JSON array.
- *
- * \param json JSON object to validate.
- * \param fn Validator to call on every element in the array.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_list(struct ast_json *json, int (*fn)(struct ast_json *));
- /*! @} */
- /*!
- * \brief Function type for validator functions. Allows for
- */
- typedef int (*ari_validator)(struct ast_json *json);
- {{#apis}}
- {{#api_declaration}}
- {{#models}}
- /*!
- * \brief Validator for {{id}}.
- *
- * {{{description_dox}}}
- *
- * \param json JSON object to validate.
- * \returns True (non-zero) if valid.
- * \returns False (zero) if invalid.
- */
- int ast_ari_validate_{{c_id}}(struct ast_json *json);
- /*!
- * \brief Function pointer to ast_ari_validate_{{c_id}}().
- *
- * See \ref ast_ari_model_validators.h for more details.
- */
- ari_validator ast_ari_validate_{{c_id}}_fn(void);
- {{/models}}
- {{/api_declaration}}
- {{/apis}}
- /*
- * JSON models
- *
- {{#apis}}
- {{#api_declaration}}
- {{#models}}
- * {{id}}
- {{#properties}}
- * - {{name}}: {{type.name}}{{#required}} (required){{/required}}
- {{/properties}}
- {{/models}}
- {{/api_declaration}}
- {{/apis}} */
- #endif /* _ASTERISK_ARI_MODEL_H */
|