)]}'
{"oslo_db/validation.py":[{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"ad5d3727b7af13d1a8612290c182d012211fb1f1","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from oslo_db import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_db_int(**kwargs):"},{"line_number":22,"context_line":"    \"\"\"Check arguments are less than or equal to max value of SQL integer type."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    This function checks that given arguments are of type int and less than or"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a122d0e_75c94079","line":21,"updated":"2016-04-22 17:05:20.000000000","message":"To be honest, I\u0027m not keen on the idea of having this in oslo.db...\n\nI understand, you kind of have already fixed Mike\u0027s comment and at least put this into a separate module, but still.. Can we maybe think of a better place to have helper functions like these?","commit_id":"d4c7165560fc80070cb691c13aa6c560a2239693"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"39273b5dcdddd4e769057fc8b3f0fbbedce7e31b","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from oslo_db import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_db_int(**kwargs):"},{"line_number":22,"context_line":"    \"\"\"Check arguments are less than or equal to max value of SQL integer type."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    This function checks that given arguments are of type int and less than or"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_ed561705","line":21,"in_reply_to":"1a122d0e_75c94079","updated":"2016-06-03 12:07:56.000000000","message":"Roman,\n\nCould you elaborate more on why you don\u0027t think it\u0027s a good idea to have this in oslo.db? To me this is where it should live rather than having a copy of this function in Glance and other projects.","commit_id":"d4c7165560fc80070cb691c13aa6c560a2239693"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"b642f05f1dea52e6eb47a9fe1910e8ab13834895","unresolved":false,"context_lines":[{"line_number":18,"context_line":"from oslo_db import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_db_int(**kwargs):"},{"line_number":22,"context_line":"    \"\"\"Check arguments are less than or equal to max value of SQL integer type."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    This function checks that given arguments are of type int and less than or"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_42c56d3b","line":21,"in_reply_to":"9abb7d3a_ed561705","updated":"2016-06-03 13:23:46.000000000","message":"Well, the code below has little to do with DB - it might as well be used for checking whether an arbitrary integer value falls into a predefined  range (which happened to be a 32bit signed int value for a reason unknown..).\n\nI\u0027d rather we split all the checks we do into two categories:\n\n1) ones that are performed for the user input in the APIs - they can be done by the means of jsonschema, trafaret (https://github.com/Deepwalker/trafaret), etc, which allow one to define advanced validation patterns and provide error reporting for users \n\nI think the validator this patch adds falls into this category\n\n2) DB integrity checks performed by RDBMS based on a schema constraints\n\nI understand, that the latter does not provide good error reporting, but we try to ease the pain by implementing some additional error parsing in oslo.db (https://github.com/openstack/oslo.db/blob/master/oslo_db/sqlalchemy/exc_filters.py)","commit_id":"d4c7165560fc80070cb691c13aa6c560a2239693"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"ad5d3727b7af13d1a8612290c182d012211fb1f1","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"def validate_db_int(**kwargs):"},{"line_number":22,"context_line":"    \"\"\"Check arguments are less than or equal to max value of SQL integer type."},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    This function checks that given arguments are of type int and less than or"},{"line_number":25,"context_line":"    equal to max value of SQL integer type i.e. 2 ** 31 - 1. If not, it will"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a122d0e_75c5c03b","line":22,"updated":"2016-04-22 17:05:20.000000000","message":"What about other integral types? This seems to be a bad abstraction. I\u0027d rather we keep user input validation to APIs and let it fail in the DB, if something manages to leak through.","commit_id":"d4c7165560fc80070cb691c13aa6c560a2239693"}]}
