Created
October 2, 2018 16:31
-
-
Save hughdbrown/6e01ceb4578d5831a7d3935b0955678c to your computer and use it in GitHub Desktop.
How the DataRobot mixins work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ParamValidationMixin | |
public_api/rest_generics/controllers.py | |
- uses flask.request.view_args: http:/x.com/project/<pid> | |
- derived from flask.MethodView, so REST methods are generated automatically | |
- http://flask.pocoo.org/docs/0.12/views/#method-based-dispatching | |
- values are accessible through dict named self.params | |
- ParamValidationMixin.param_validator_class | |
QueryValidationMixin | |
public_api/rest_generics/filters.py | |
- works on query args: http:/x.com/path/?project=deadbeefdeadbeef | |
- provides no REST-named methods | |
- main interface is through get_query_params() which provides a dict of arguments (including flask.request.args) | |
- QueryValidationMixin.query_validator_class | |
PayloadValidationMixin | |
public_api/rest_generics/controllers.py | |
- REST-named methods: post, put, patch, delete | |
- uses flask.request.data | |
- PayloadValidationMixin.validator_class | |
- values are accessible through dict named validator.data in the scope of validator_valid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment