)]}'
{"doc/source/contributor/api_validators.rst":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":38,"context_line":"any exceptions and either return ``None`` (success) or a ``ValidationResult``"},{"line_number":39,"context_line":"object indicating failure. The only proper case for a validator to"},{"line_number":40,"context_line":"raise an exception is to indicate a programmatic error. This would"},{"line_number":41,"context_line":"result in a ``500`` at the REST API level; as desired indicating something"},{"line_number":42,"context_line":"is not implemented properly in the code rather than a validation"},{"line_number":43,"context_line":"error on request data."},{"line_number":44,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_8e04f94b","line":41,"range":{"start_line":41,"start_character":41,"end_line":41,"end_character":54},"updated":"2018-01-15 21:41:33.000000000","message":"I would remove this and replace it just with a comma","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":43,"context_line":"error on request data."},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"The ``ValidationResult`` object is used in API exception building and"},{"line_number":46,"context_line":"should have it\u0027s ``msg`` attribute populated with an i18n string indicating the"},{"line_number":47,"context_line":"validation failure message. In addition the ``ValidationResult``"},{"line_number":48,"context_line":"object should have it\u0027s ``invalid_data`` attribute populated if"},{"line_number":49,"context_line":"validation failed on sub-data (e.g. processing some sub-element"}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_2ec285ea","line":46,"range":{"start_line":46,"start_character":12,"end_line":46,"end_character":17},"updated":"2018-01-15 21:41:33.000000000","message":"its","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":45,"context_line":"The ``ValidationResult`` object is used in API exception building and"},{"line_number":46,"context_line":"should have it\u0027s ``msg`` attribute populated with an i18n string indicating the"},{"line_number":47,"context_line":"validation failure message. In addition the ``ValidationResult``"},{"line_number":48,"context_line":"object should have it\u0027s ``invalid_data`` attribute populated if"},{"line_number":49,"context_line":"validation failed on sub-data (e.g. processing some sub-element"},{"line_number":50,"context_line":"of the original data)."},{"line_number":51,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_4eacb133","line":48,"range":{"start_line":48,"start_character":19,"end_line":48,"end_character":23},"updated":"2018-01-15 21:41:33.000000000","message":"its","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":53,"context_line":"and then includes the data type. For example::"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"   def validate_restricted_uuid_list(data, restricted_uuids\u003dNone):"},{"line_number":56,"context_line":"       if not type(data) is list:"},{"line_number":57,"context_line":"           msg \u003d _(\"\u0027%s\u0027 is not a valid list\") % data"},{"line_number":58,"context_line":"           return ValidationResult(msg\u003dmsg)"},{"line_number":59,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_8e25d9c4","line":56,"range":{"start_line":56,"start_character":15,"end_line":56,"end_character":32},"updated":"2018-01-15 21:41:33.000000000","message":"we prefer isinstance","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":79,"context_line":"In consuming code, one or more validators can be used in a REST API by"},{"line_number":80,"context_line":"using a dictionary key per validator in the ``validate`` attribute of the"},{"line_number":81,"context_line":"attribute map definition. Here the key is the validation type to use"},{"line_number":82,"context_line":"(ex: ``type:restricted_uuid_list``) and the value contains options to"},{"line_number":83,"context_line":"pass to the validation function."},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"For example:"}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_715070d5","line":82,"range":{"start_line":82,"start_character":58,"end_line":82,"end_character":67},"updated":"2018-01-15 21:41:33.000000000","message":"arguments?","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":109,"context_line":""},{"line_number":110,"context_line":"Here, the networks resource has an ``id`` attribute with a UUID list validator,"},{"line_number":111,"context_line":"as seen by the ``validate`` key containing a dictionary with a key of"},{"line_number":112,"context_line":"``type:restricted_uuid_list``. As the value of the ``type:restricted_uuid_list``"},{"line_number":113,"context_line":"is list of valid UUID strings (defined in ``RESTRICTED_UUIDS`` elsewhere in this"},{"line_number":114,"context_line":"example), it\u0027s passed to the ``validate_restricted_uuid_list`` function in the"},{"line_number":115,"context_line":"``restricted_uuids`` argument."}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_d1ddc442","line":112,"range":{"start_line":112,"start_character":51,"end_line":112,"end_character":80},"updated":"2018-01-15 21:41:33.000000000","message":"``type:restricted_uuid_list`` key","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":126,"context_line":""},{"line_number":127,"context_line":"To implement a custom validation exception, your exception class must include"},{"line_number":128,"context_line":"the ``ValidationExceptionMixin`` in it\u0027s inheritance chain. The constructor"},{"line_number":129,"context_line":"accepts a since argument of type ``ValidationResultDetails`` that provides"},{"line_number":130,"context_line":"detailed information about the value the failed validation, the offending"},{"line_number":131,"context_line":"value(s), etc."},{"line_number":132,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_51221402","line":129,"range":{"start_line":129,"start_character":10,"end_line":129,"end_character":15},"updated":"2018-01-15 21:41:33.000000000","message":"single","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":144,"context_line":""},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"To specify the custom exception class in the attribute definition, a"},{"line_number":147,"context_line":"``ValidationOpts`` must be used as the value for the validate key."},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"For example::"},{"line_number":150,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"7f96bb07_0f18e0d0","line":147,"range":{"start_line":147,"start_character":1,"end_line":147,"end_character":17},"updated":"2018-01-15 21:41:33.000000000","message":"It might be that I am too slow, but I would have benefited from a little more explanation on what the ValidationOpts does and how it replace the traditional options :-)","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"}],"releasenotes/notes/custom-api-validator-exceptions-2a000c6a89efc5cf.yaml":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"c98a8f0f3ce0d34aab232ded7bbf5b6110f4aee4","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - API defintions can now specify a custom exception class to be used"},{"line_number":4,"context_line":"    when validation fails. This class is specified on the ``validate``"},{"line_number":5,"context_line":"    API attribute defintion."}],"source_content_type":"text/x-yaml","patch_set":3,"id":"7f96bb07_6fdba4ec","line":3,"range":{"start_line":3,"start_character":4,"end_line":3,"end_character":59},"updated":"2018-01-15 21:41:33.000000000","message":"This really happens through the ValidationOpts class. It might be worth clarifying that","commit_id":"3b0494085371be867ba369b22075f9913fac32b6"}]}
